469,946 Members | 1,866 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

Problem with special chars

Hi everyone,

I've got a problem with a piece of javascript code which parses a
string. The problem occurs when the string contains some special
characters like , , ...

There are 2 symptoms
The string shows up incomplete, i.e. Gnther =G? or sometime I have
javascript error :
"End of file reached in invalid state for current encoding"

The string is used to populate a select box, so converting the special
chars into HTML entities didn't work...

Could anyone help me out ?
Thx!
Mathew

Mar 13 '07 #1
2 3948
Lupus wrote:
I've got a problem with a piece of javascript code which parses a
string. The problem occurs when the string contains some special
characters like , , ...

There are 2 symptoms
The string shows up incomplete, i.e. Gnther =G? or sometime I have
javascript error :
"End of file reached in invalid state for current encoding"
Well make sure you choose an appropriate encoding for your files and use
a text editor which saves in that encoding, then make sure the HTTP
server serves the files indicating the encoding.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 13 '07 #2
Lupus wrote:
I've got a problem with a piece of javascript code which
parses a string. The problem occurs when the string contains
some special characters like , , ...

There are 2 symptoms
The string shows up incomplete, i.e. Gnther =G? or sometime
I have javascript error :
"End of file reached in invalid state for current encoding"

The string is used to populate a select box, so converting the
special chars into HTML entities didn't work...
One possible solution which allows you to use all characters that a
browser can display, without needing to save them as such:

alert('\u00e8\u00e9\u00fc')

The tables at http://unicode.coeurlumiere.com/ give you every code
point that the javascript engine supports (65535 combinations in hex).
Just replace the last zero of the left code by the character in the
upper row, like eg \u0079 for 'y'.

With this approach you can always save your programming code in ASCII,
which is a full guarantee to never have this kind of problems. Quick
and dirty! :)

--
Bart

Mar 13 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jonas Meurer | last post: by
6 posts views Thread by Horst Gutmann | last post: by
2 posts views Thread by Thorsten Viel | last post: by
8 posts views Thread by abhi147 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.