I'm trying to bring in a csv for some javascript to munch on and spit out on an html page. The csv has some special characters like ½ and ×. According to Firebug, when I put a breakpoint inside the callback of $.get(), it looks like already there the special characters are missing. They are replaced with some sort of whitespace that displays as a question mark or box if I copy and past it into another program.
I have tried
$.ajaxSetup({
dataType: "text" ,
contentType: "text/plain; charset=utf-8"
});
and other variations. The doctype of my webpage is utf-8. I have also tried 8859-1. Nothing so far has worked.
EDIT: placing the characters by hand into the html either as is or using html entity codes works fine. Placing them with javascript works too. The only problem is reading this CSV file.
EDIT2: Try this. Create a text file with this in it Öç¼»
. Then create a webpage like so...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$.get("encodeme.txt", function(data){
console.log(data);
})
</script>
</head>
<body>
</body>
</html>
All that is logged is a whitespace and Chinese character: �缻
. Notice that the whitespace appears as a qestion mark thingy when I copypaste it.