MView cannot recognize [N+] atoms

User bf3dbc99cf

07-04-2008 02:15:38

Hi, there.





I cannot draw molecules having positive charge (N+) in mview such that as follows.








<html>





<body>





<script LANGUAGE="JavaScript1.1" SRC="../marvin/marvin.js"></script>


<script LANGUAGE="JavaScript1.1">


<!--


mview_begin("../marvin", 300, 300 );


mview_param("background", "#FFFFF0");


mview_param("molbg", "#FFFFFF");


mview_param("mol", "CC(C)n1nc(O)c2C(SCC(=O)Nc12)c1cccc(c1)[N+]([O-])=O" );


mview_end();


//-->


</script>





</body>





</html>








The error message saids that it cannot recognize the [N+] atoms.


The mview seems to replaces '+' with '_blank_'.


>> chemaxon.formats.MolFormatException: Cannot recognize format (?)


>> Unrecognized file contents:


>> CC(C)n1nc(O)c2C(SCC(=O)Nc12)c1cccc(c1)[N ]([O-])=O








But I can draw molecules having negative charges such as [N-].





What's the problem?





Thank you.

ChemAxon 7c2d26e5cf

08-04-2008 16:01:17

I don't know which Marvin version you use. But your example works fine with the latest Marvin (5.0.2.1). Please try out this online example:


applet parameter example

User bf3dbc99cf

11-04-2008 08:13:08

Dear Tamas.


Thank you for your kind reply.


Finally I found what's the problem with me.





The applet_param() function in marvin.js causes problem in NON-ENGLISH regions when dealing with the '+' characters.


(I use the 'euc-kr' unicode encoding scheme)


I have ad hoc patched the function as follows, arbeit not the best solution.


Can you provide me better solution?


Thank you.











function applet_param(name, value)


{


var s;


value="@javascript-URI-encoded@"+encodeURI(value);


if( 'mol' == name || 'cell' == name.substr(0,4) ) {


var str = "";


for( i=0; i<value.length; i++ ) {


c = value.charAt(i);


str += ( '+' == c ) ? '%2B' : c;


}


value = str;


//alert( value );


}





if(applet_type == 1) { // <embed>


s = name+'="'+value+'"\n';


} else { // <applet> and <object>


s = '<param NAME="'+name+'" VALUE="'+value+'">\n';


}


document.write(s);


return s;


}

ChemAxon 7c2d26e5cf

11-04-2008 08:38:34

Probably, you use an earlier Marvin version (not the latest update).


We know about this encoding issue. It appeared in Marvin 5.0 but we have already fixed it in the latest patch release (5.0.2.1).


So please update to the latest Marvin (5.0.2.1).


By the way, you are right that "encodeURI(value)" does not encode fine all characters that's why we have substituted it to "encodeURIComponent(value)" in 5.0.2.1 version.

User bf3dbc99cf

14-04-2008 01:24:36

Dear Mr. Tamas,


Thank you for your kindness.


I have updated the marvin and all problems disappeared.


Thanks.





Regards,