Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Unicode + SVG problem

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 6/1/2004 3:45:00 PM

Klaubator wrote:


> A simple task is driving me crazy, just can figure out how to
> programatically write unicode characters to a SVG (XML) document.
> 
> With an editor it is easy to write Unicode characters like &#x431
> (Cyrillic) to an SVG text element.
> 
> Trying to do the same with code is a pain but there must be some
> solution.
> 
> I've tried to do it with vb.net using both InnerHtml, InnerText and
> CDATA but the ampersand is always encoded as &amp; just can figure out
> how to add an unencoded ampersand. Tried to do the same through the
> Adobe SVG plugins Javascript method setData() but the result was the
> same. The only solution I've come up with is using XSLT
> transformations or simply postprocess the XML/SVG contents as plain
> text but this is definitely not something I would want to do.
> 
> There must be a solution to this simple task ?!

If you do DOM programming of XML documents then usually you don't need 
to escape Unicode characters as the DOM operates directly on the Unicode 
text data so you can simply use a string with the characters you want 
and insert them into a text node with DOM methods. The only problem are 
programming languages where strings are not Unicode encoded but VB.NET 
or JavaScript shouldn't be a problem. For instance with JavaScript
   textNode.setData(String.fromCharCode(0x431))
or directly
   textNode.setData('б')
should do

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent