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!
javascript html ajax encoding
Luis A. Florit Mar 23 '14 at 15:18 2014-03-23 15:18
source share