views:

279

answers:

2

How can I load Unicode Characters (specifically a trademark symbol) from XML and push it into a Form via AJAX?

When I push formelement.value += "\u2122" it works fine, but when I place "\u2122" into XML, load it via AJAX, and push it to the form element it does not work.

Any ideas?

Thanks

+1  A: 

It should work if you use UTF-8 to encode the XML document. Otherwise try to use a character reference like ™.

Gumbo
A: 

That's a javascript format; javascript understands it and converts it to the appropriate character, but the XML parser does not. Instead of '\u2122' use '™' in XML.

Bruce
Your the second person that suggested this, but I can't get it to work. I'm 99% sure everything is UTF-8, but it's not working. Any chance you can get an example running?Thanks,Colin
Colin
I'll see about producing a working sample. In the meantime, what are you doing with the posted data? How are you verifying that it doesn't work?
Bruce
Was that an attempt to put AMP - # - x 2122 SEMI into the answer? It is showing as the actual TM symbol.
bmargulies