Who is responsible for this incorrect encoding?

I have an HTML file with javascript. Javascript reads the local CSV file ISO-8859-1 through AJAX. I have stated three times that I am working with ISO-8859-1, and yet the rendering is erroneous, showing that a black square with the symbol '?' inside. What am I doing wrong? I do not know what else to try ...

Not sure if this is important, but the text I'm trying to print is the headline in google.maps.Marker . Maybe it should be utf-8? Maybe there is no way to convert a string to UTF-8?

AJAX read function in javascript:

 function loadlocalcsv(file) { var xmlHttp = new XMLHttpRequest(); xmlHttp.open("GET", file, true); xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=ISO-8859-1'); xmlHttp.addEventListener("load", ajaxCallback, false); xmlHttp.send(null); } function ajaxCallback(event){ var csv = event.target.responseText; processData(csv); } 

The HTML file has this metadata:

 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/> 

and javascript is called with this:

 <script type="text/javascript" charset="ISO-8859-1" src="mymap.js"></script> 

Thank!

+1
javascript html ajax encoding
Mar 23 '14 at 15:18
source share

No one has answered this question yet.

See similar questions:

43
How to convert UTF-8 special characters to their iso-8859-1 equivalent using javascript?

or similar:

5129
How to return a response from an asynchronous call?
3915
Why does Google add while (1); in your JSON answers?
2366
Encode URL in JavaScript?
390
How to submit FormData objects using Ajax queries in jQuery?
299
jQuery $ .ajax (), $ .post sends "OPTIONS" as REQUEST_METHOD in Firefox
56
Set character encoding in submit form for Internet Explorer
46
Unable to display HTML string
8
set encoding in rails application
8
ajax, setRequestHeader (), Content-Type, application / x-www-form-urlencoded and charset
0
Submit ajax form created by ajax call



All Articles