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

Latin encoding in ajax

Hi, i am trying to fill a dropdown menu with ajax, but the table
contains latin characters. In mozilla i get a weird black character
instead, and in internet explorer the whole code breaks because if a
word ends in a latin character then it ignores the <bri put on the
end, therefore affecting my data logic.

I am using results = http.responseText.split("<br>"); as a delimiter.

Is there a way to fix this without resorting to using xml encoding?

Aug 1 '06 #1
2 2239


Seguros Catatumbo wrote:
Hi, i am trying to fill a dropdown menu with ajax, but the table
contains latin characters. In mozilla i get a weird black character
instead, and in internet explorer the whole code breaks because if a
word ends in a latin character then it ignores the <bri put on the
end, therefore affecting my data logic.

I am using results = http.responseText.split("<br>"); as a delimiter.
Mozilla (and Opera) should do if you tell them the encoding with a HTTP
response header e.g.
Content-Type: text/html; charset=WINDOW-1252
or
Content-Type: text/html; charset=ISO-8859-1

But with IE which uses MSXML if you use responseText I can only suggest
to make sure your response sent to the browser is UTF-8 encoded. MSXML
assumes that when decoding the response body.
Or use JSON which sends strings as ASCII with other characters in
JavaScript being encoded by JavaScript means (e.g. \uhhhh or \xhh).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 1 '06 #2
Seguros Catatumbo wrote:
Hi, i am trying to fill a dropdown menu with ajax, but the table
contains latin characters. In mozilla i get a weird black character
instead, and in internet explorer the whole code breaks because if a
word ends in a latin character then it ignores the <bri put on the
end, therefore affecting my data logic.

I am using results = http.responseText.split("<br>"); as a delimiter.

Is there a way to fix this without resorting to using xml encoding?
I think you can diagnose your problem by finding out what is the hex
code that causes the trouble:

var str = 'Xéл€';
for (i=0;i<str.length;i++)
alert('hex code at pos '+i+' is '+str.charCodeAt(i).toString(16));

Then you could replace the hex value of the wrong character by another
character. Say you find out the Euro-sign would be your problem (hex
20AC), and you want to replace it by capital 'E', then you could do
something like:

str = '€';
uhex = '\\' + 'u' + str.charCodeAt(0).toString(16);
str = str.replace(new RegExp(uhex,'g'),'E')
alert(str)

Hope this helps,

--
Bart

Aug 2 '06 #3

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

Similar topics

4
by: francescomoi | last post by:
Hi. I'm trying to store a text within a MySQL field (v 3.23.58) by using MySQLdb (v 1.2.1c3). The text is: "telephone..." (note the last character) And I get this error message:...
17
by: thinkfirst | last post by:
Hello CIWAH ... I want to propose full internationalization of three related websites: http://africadatabase.org/ http://people.africadatabase.org/ http://institutions.africadatabase.org/ My...
10
by: Arne | last post by:
Since I am Swedish, I write website content mostly in Swedish language and using charset iso-8859-1. I have (just for testing) tried to use utf-8 on a test page (...
2
by: Riku Kangas | last post by:
Hi, I have a web service with a javascript line like this to send user input to another frame: <code> parent.isk_artlist_top.location.href='artlist_top.asp?ss='+escape(document.h...
9
by: Andy | last post by:
I am trying to write a for loop that will print all the ISO-Latin characters to a database. However: I am not sure exactly how to go about printing the ISO-Latin character set. Would anyone be...
2
by: junk | last post by:
Hi, Sorry if this has been asked before, and apologise if this is the wrong NG. I am using PHP 5.0.5 and Apache 2.0.54 in a Win2k environment. Lately I have been playng with RSS feeds. I...
1
by: Chris Curvey | last post by:
Hey all, I'm trying to write something that will "fail fast" if one of my users gives me non-latin-1 characters. So I tried this: u'\x80' I would have thought that that should have raised...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.