Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Unicode + SVG problem

Reply
Thread Tools

Unicode + SVG problem

 
 
Klaubator
Guest
Posts: n/a
 
      06-01-2004
Hi,

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 & 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 ?!

Regards
KL
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      06-01-2004


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 & 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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: svg-chart 1.1 SVG Charting Library Helmut Jarausch Python 0 05-20-2008 11:05 AM
svg to svg saving problem milof83 Java 1 08-18-2006 07:36 PM
[SVG] probleme dessin d'images SVG avec Batik Mardagg Java 0 05-12-2006 02:13 PM
[SVG] problem with SVG image drawing with Batik Library Mardagg Java 0 05-12-2006 02:12 PM
[SVG] using image-tag to integrate SVG in SVG Arne Nordmann XML 0 06-28-2004 01:16 PM



Advertisments