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