Andrew Poulos wrote:
> I've written some javascript for a client that uses some in-house tool
> to create HTML. They are upgrading their tool so that it handles unicode
> (so they can, for example, insert Japanese ideograms directly into the
> HTML).
>
> The pages display in IE 7 but Firefox, Chrome etc complain about an
> illegal character and then
>
> Error: uncaught exception: [Exception... "Component returned failure
> code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIDOMLocation.replace]"
> nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" *location: "JS frame ::
> file:///C:/Users/Andrew/Desktop/Project/Standalone/content/index.htm ::
> anonymous :: line 44" *data: no]
>
> and no javascript runs.
>
> When I build the pages from scratch they display.
>
> When I examine their pages they are encoded in UTF-16 with Unix style
> line ending.
>
> I manually changed the encoding to UTF-8 but it made no difference.
>
> If I comment out the javascript the page displays fine.
>
> I'm kind of lost with unicode. Is their something I can tell their
> developers to stop them killing my javascript?
Welcome to Unicode!

It's difficult to say anything concrete without being able to look at
the code. My first idea is that some byte ranges cannot be recognized
because browsers can use various UTF-16 character tables (more vs.
less extended, esp. in the higher code points). Does it fail at the
first Unicoded char that it meets ?
Here are some basic thoughts:
- Definitely go for UTF-8, not UTF-16.
- Make sure that the HTTP-header is correct (Content-Type: text/html;
charset=utf-

.
- The server-script must send data that has been correctly converted
into an Unicode set (sounds easy, I know...)
- In HTML source code, add a meta-tag in the header <meta http-
equiv="Content-Type" content="text/html; charset=UTF-8">.
- A Unix style line-ending should *normally* be okay; better is to use
\r\n anyhow.
I understand the Unicode characters reside in javascript only. You
could ask their IT guys to send \uXXXX. NS_ERROR_FILE_NOT_FOUND seems
to indicate a 404 error -> maybe you are using Unicode characters in
file names ? (=definitely to avoid)
Hope this helps,
--
Bart