[jQuery] utf8 request/response headers
Quick summary: I'm trying to submit utf8 characters via AJAX to a
database.
The data submitted via the form includes a text field with utf8
characters, including this one. They look normal in the post headers.
http://www.fileformat.info/info/unicode/char/2022/index.htm
The response headers include unparseable unicode codes, which for that
character (the bullet) is the "\u2022". The following is getting
inserted into the database in place of the bullet character. "%u2022"
I am pretty sure its javascript related.
Response Headers
Date Thu, 31 Jul 2008 21:47:58 GMT
Server Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e
mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
X-Powered-By PHP/5.2.6
Vary Accept-Encoding
Content-Encoding gzip
Content-Length 1764
Keep-Alive timeout=2, max=100
Connection Keep-Alive
Content-Type text/html
Request Headers
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1)
Gecko/2008070208 Firefox/3.0.1
Accept text/html, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
Content-Type application/x-www-form-urlencoded; charset=UTF-8
FORM
....
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<script type="text/javascript" src="/js/jquery.js" charset="utf-8"></
script>
<script type="text/javascript" charset="utf-8">
....
jQuery.ajax({
type: "POST",
dataType: "html",
data: inputs.join('&'),
url: this.action,
timeout: 2000,
success: function(){
//alert(inputs);
hideLoading();
$('form').clearForm();
}
});
......
<form name"fooo" id="bar" accept-charset="utf-8" action="/more/foobar"
method="post">
MYSQL
Coallation Type: utf8_general_ci
Character Set: utf8
I>>>>>>>>>>>>
I echo the the data passed to the php form processing so that it goes
to the Response tab in firebug.
IN FIREBUG POST TAB
• Constant
IN FIREBUG RESPONSE TAB
%u2022 Constant
This is even before it gets to the database, but I included database
config to let you know I already thought to check that. :) I have run
the data through >> htmlentities($content); <<
What am I missing?