473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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. Günther =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 4128
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. Günther =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. Günther =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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jonas Meurer | last post by:
hello, my script selects a comment saved as VARCHAR in MySQL and displays it inside an html page. the problem is, that the comment contains several special characters, as mysterious utf-8...
6
by: Horst Gutmann | last post by:
Hi :-) I currently have quite a big problem with minidom and special chars (for example ü) in HTML. Let's say I have following input file:...
2
by: Thorsten Viel | last post by:
Hi List, im trying to use special chars with the std::string (like S) but when i cout<< the string the special chars have disappeared. What's wrong here? Thanks in advance
4
by: dutch disCo | last post by:
Hi, I'm trying to use GET method to pass variables through my script files. Unfortunately, when a special char (&, ?, +) is being posted the variable gets trimmed in a very strange way. I'm...
3
by: VMI | last post by:
When I execute a ReadLine from an ascii file with special chars (ie. the 'Ñ' in "NUÑEZ PEREZ"), it automatically deletes this character. So "NUÑEZ PEREZ" becomes "NUEZ PEREZ". How can this be...
0
by: Frank M | last post by:
I am writing an application with a dataload class. The development is done in Windows XP, and on the development Pc I can do a dataload and export without any problems if I use...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
8
by: abhi147 | last post by:
Hi , I have been trying to convert a 32 bit string like "b2a4fdf15af7c4f215e1909be4707bdb" to convert to a string of special chars like "²¤ýñZ÷Äòá?›äp{Û" I have tried a lot of things .. but...
5
by: Alex | last post by:
Hi all - Is there a standard way to handle special chars in strings in dotnet? I'm using csharp and having two seperate problems... 1. Passing in args... I need to pass in an arg that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.