Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript character issue 2

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
CA
I have javascript code like the following. I am using Apache/UNIX

CASE 1

Code:
if (document.formDetails.first_name.value=="" || document.formDetails.first_name.value=="*Prénom") {

errmessage = errmessage + " -prénom";

}



when this file go to one of the unix box it look like the following

Code:
if (document.formDetails.first_name.value=="" || document.formDetails.first_name.value=="*Prénom") {

errmessage = errmessage + " -prénom";

}

my if statement work fine here

CASS 2.
when same code goes to the other unix box and I look at it looks like

Code:
if (document.formDetails.first_name.value=="" || document.formDetails.first_name.value=="*Pr\303\251nom") {

errmessage = errmessage + " -pr\303\251nom";

On this box my if statement does not work even if the condition is met.

My questions are

1. Why the character turn into numbers, is it something to do with UNIX setting etc?


2. Most puzzling is when I do view source on browswer in both cases code look identical. like

if (document.formDetails.first_name.value=="" || document.formDetails.first_name.value=="*Prénom") {

errmessage = errmessage + " -prénom";

}

Javascript runs on client side, so it shoud not matter even if code look like Pr\303\251nom at the sever. SO I don't understand why code does not work in case 2. Infact if I do view souce at save it, and open in the browswer it works, but just does not work on the website.








 
Do you have a charset definition at the top of your file? If so, what is it? If not, have you tried either UTF-8, UTF-16, or ISO-8859-1?

E.g:

Code:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Hi

Beside that, does your server send [tt]charset[/tt] parameter in the [tt]Content-type[/tt] HTTP header ? If so, is the same as the one specified in the HTML [tt]head[/tt] ?

Feherke.
 
yes I have that on header UTF-8

Code:
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">

One thing that puuzzle me, the view source looks right with no charater turning to digits. , and even if I save the view source in a file, it works fine, but then how come it does not work on the website

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top