473,387 Members | 1,495 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,387 software developers and data experts.

Special characters problem

hi guys,

based on users button press i am passing the following to my javascript
function, test('é'). and within my javascript i have this
function test(x) which processes this input.

now i am comparing this input using this, if ((x == "é")) {
alert ('eacute clicked') }, but i am unable to capture this for some
reason. everything else works. except special characters. btw i am
using english operating system.

has anybody else has had this problem, and can someone suggest a fix.

thanks.

Nov 3 '06 #1
7 7040

pe******@gmail.com wrote:
hi guys,

based on users button press i am passing the following to my javascript
function, test('é'). and within my javascript i have this
function test(x) which processes this input.

now i am comparing this input using this, if ((x == "é")) {
alert ('eacute clicked') }, but i am unable to capture this for some
reason. everything else works. except special characters. btw i am
using english operating system.

has anybody else has had this problem, and can someone suggest a fix.

thanks.
try to insert "alert(x)" before that "if" and you will see why
x=="é" is false

Nov 3 '06 #2
uoL
hi,
I have a similar problem .. I use spanish language and i need to use
both question marks (¿?) and when i put ¿ into an alert .. alert
('¿') it shows this one '?' so a question that should be like this
¿desea activar? is displayed like this ?desea activar? ... I tried
with ¿ but it doesn't work ..

thanks

sc********@gmail.com wrote:
pe******@gmail.com wrote:
hi guys,

based on users button press i am passing the following to my javascript
function, test('é'). and within my javascript i have this
function test(x) which processes this input.

now i am comparing this input using this, if ((x == "é")) {
alert ('eacute clicked') }, but i am unable to capture this for some
reason. everything else works. except special characters. btw i am
using english operating system.

has anybody else has had this problem, and can someone suggest a fix.

thanks.

try to insert "alert(x)" before that "if" and you will see why
x=="é" is false
Nov 3 '06 #3
pe******@gmail.com wrote:
based on users button press i am passing the following to my javascript
function, test('é'). and within my javascript i have this
function test(x) which processes this input.

now i am comparing this input using this, if ((x == "é")) {
alert ('eacute clicked') }, but i am unable to capture this for some
reason. everything else works. except special characters. btw i am
using english operating system.
How about showing us the relevant code, meaning the markup of the button
and its event handlers, the function.

I suspect you have e.g.
<input type="button" onclick="test('&eacute;')"
which means the HTML parser dereferences the entity reference &eacute;
to the character é.

Then your function is defined inside of a <script
type="text/javascript"element e.g.
function test (x) {
if (x == "&eacute;")

Inside of the script element the HTML parser does not dereference HTML
entity references thus the JavaScript string comparison is e.g.
'é' == '&eacute;'
and those strings are obviously not the same.

So the solution is to compare e.g.
if (x == 'é')
at least as long as your calls to the function passing the argument with
HTML entity references are inside HTML event handler attributes like
onclick.

See <http://www.w3.org/TR/html4/types.html#h-6.2>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 3 '06 #4
ASM
uoL a écrit :
hi,
I have a similar problem .. I use spanish language and i need to use
both question marks (¿?) and when i put ¿ into an alert .. alert
('¿') it shows this one '?' so a question that should be like this
¿desea activar? is displayed like this ?desea activar? ... I tried
with &iquest; but it doesn't work ..
è = \xe8
é = \xe9
¿ = \xBF
ò = \xF1
ó = \xF3

alert('\xbf heart ? Qu\xe9 ! Es el coraz\xf3n en espa\xf1ol !');

http://www.miakinen.net/vrac/charsets/
(wait loading ...)
You click a glyfe and you see on right pannels its different codes
specialy that 'hexa'

then to use this hexa in JS alerts, prompts ans so on :

\xYY where YY is hexa code of character

hexa table (not complete) :
<http://groups.google.fr/group/fr.comp.infosystemes.www.auteurs/msg/b5147e55ed87f1a7?hl=fr&>
--
ASM
Nov 3 '06 #5
uoL

It worked !! thanks !

ASM wrote:
uoL a écrit :
hi,
I have a similar problem .. I use spanish language and i need to use
both question marks (¿?) and when i put ¿ into an alert .. alert
('¿') it shows this one '?' so a question that should be like this
¿desea activar? is displayed like this ?desea activar? ... I tried
with &iquest; but it doesn't work ..

è = \xe8
é = \xe9
¿ = \xBF
ò = \xF1
ó = \xF3

alert('\xbf heart ? Qu\xe9 ! Es el coraz\xf3n en espa\xf1ol !');

http://www.miakinen.net/vrac/charsets/
(wait loading ...)
You click a glyfe and you see on right pannels its different codes
specialy that 'hexa'

then to use this hexa in JS alerts, prompts ans so on :

\xYY where YY is hexa code of character

hexa table (not complete) :
<http://groups.google.fr/group/fr.comp.infosystemes.www.auteurs/msg/b5147e55ed87f1a7?hl=fr&>
--
ASM
Nov 3 '06 #6
"uoL" <wm*****@gmail.comwrote in news:1162557034.357432.293900
@f16g2000cwb.googlegroups.com:
hi,
I have a similar problem .. I use spanish language and i need to use
both question marks (¨?) and when i put ¨ into an alert .. alert
('¨') it shows this one '?' so a question that should be like this
¿desea activar? is displayed like this ?desea activar? ...
alert('¿desea activar?'); shows exactly that, in FF 1.5 and IE 6.0.

What browser are you using, that doesn't show what you want?
Nov 4 '06 #7
ASM
Jim Land a écrit :
"uoL" <wm*****@gmail.comwrote in news:1162557034.357432.293900
@f16g2000cwb.googlegroups.com:
>hi,
I have a similar problem .. I use spanish language and i need to use
both question marks (¨?) and when i put ¨ into an alert .. alert
('¨') it shows this one '?' so a question that should be like this
¿desea activar? is displayed like this ?desea activar? ...

alert('¿desea activar?'); shows exactly that, in FF 1.5 and IE 6.0.

What browser are you using, that doesn't show what you want?
All depends what headers are sent ... (charset and all that )
and if charset of encoding it in accordance with this of text editor.

Probably depends too if there is a doctype on the page
Nov 4 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
3
by: Barry Olly | last post by:
Hi, I'm working on a mini content management system and need help with dealing with special characters. The input are taken from html form which are then stored into a varchar column in...
4
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am...
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: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
5
by: Doc | last post by:
Hello! I'm experiencing a little problem counting the number of characters in a textarea on a html page. This is the content type of my HTML document content="text/html; charset=iso-8859-1" ...
1
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file,...
7
by: Trac Bannon | last post by:
When I load XML from a file into a dotNet XMLDataDocument, the UTF-8 codes are resolved but the 5 special XML entities are not. How can I force those 5 special character types to be translated?
6
by: TheRealDan | last post by:
Hi all. I'm having a problem with a special characters. I have php script that reads from an xml file and writes to a mysql db. It's a script called phptunest that I found on the net, although the...
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.