Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- From: vunet.us@xxxxxxxxx
- Date: Fri, 29 Jun 2007 16:22:04 -0000
On Jun 29, 12:01 pm, Martin Honnen <mahotr...@xxxxxxxx> wrote:
vunet...@xxxxxxxxx wrote:
Browsers convert my ASCII fine when webpage is set to
charset=iso-8859-1.
However, my AJAX app has too many cases with
var myASCII = "ü";
document.createTextNode(myASCII);
In this case or similar, such as option.text = myASCII; for select
object, browsers fail to convert ASCII to HTML.
The createTextNode method takes a DOM string, in JavaScript that is
simply a JavaScript string so try
document.createTextNode("ü")
or
document.createTextNode(String.fromCharCode(0xFC))
or
document.createTextNode("\u00FC")
The ü syntax is a numeric character reference meant for an HTML
or XML parser. createTextNode does not do any HTML or XML parsing.
--
Martin Honnen
http://JavaScript.FAQTs.com/
Yes, Unicode works well: document.createTextNode("\u00FC"). However,
my strings look like:
var myASCII = "Do not remove text ü and do not remove text,
blah blah";
document.createTextNode(myASCII);
and there are plenty of different strings containing all possible
ASCII values. What would you recommend in that case. Is it possible to
convert all ASCII to Unicode, then?
.
- Follow-Ups:
- Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- From: Martin Honnen
- Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- References:
- Browser Converts No ASCII for JS Text Node or any Text Attribute
- From: vunet . us
- Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- From: Martin Honnen
- Browser Converts No ASCII for JS Text Node or any Text Attribute
- Prev by Date: Re: Client Side Vs Server Side Java Script
- Next by Date: Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- Previous by thread: Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- Next by thread: Re: Browser Converts No ASCII for JS Text Node or any Text Attribute
- Index(es):
Relevant Pages
|