negative charge in svg export

12-10-2005 15:08:48

I use the Marvin Beans API to convert a molecule into SVG image format.


I have got a problem with the svg export since I upgraded to Marvin 4.0.1.


My problem is that the '-' symbols are replaced in the SVG output by "Ć¢EUR". (Note: This strange character combination can be differ depending on what editor I use.)


In Marvin 3.2, negative charge were marked with '-'. But now, my editors can not interpret the new sign of negative charge.

ChemAxon 7c2d26e5cf

12-10-2005 15:16:27

The sign of negative charge has been changed. Marvin uses '\u2013' (that is non-ascii character) instead of '-'.


If you read the following topic, you will understand why we have chosen '\u2013' to sign negative charge.


http://www.chemaxon.com/forum/ftopic86.html


Because of the non-ascii characters, Marvin's SVG export generates an UTF-8 encoded output.


Using non-ascii characters can cause problem if you do not read it in UTF-8 format. In Windows, a few programs detect automatically that these files UTF-8 encoded and display them with right encoding. But a few applications try to read these files with the local encoding of Windows. In this case, non-ascii characters will not be displayed correctly.





I don't know what you use where the reading of svg files are problematic but I suggest you to try to force your application to read these svg files with UTF-8 encoding.


If you can not do this, or you do not like this solution, I can suggest you an alternative solution: Change non-ascii characters to ascii ones in your Java code. The attached example demonstrates how you can do it.