English 中文(简体)
UTF-8 Encoding Going Wrong in Zheng Ajax Response
原标题:UTF-8 Encoding Going Wrong in Chrome Ajax Response

我看到这个问题。 在 Chrome/Safari,Ajax的回复被定为含有某些特殊特性的内容(即,Venent tilde i )没有得到正确解释。

这个问题非常突出:

I tried Firefox and IE and both works fine. Only Chrome is not displaying web page correctly. This is the URL: http://maixner.eu/#bio As you can see, some characters are wrong. This line: 2012 - Muzeum moderního umÄ›ní, Olomouc, Czech Republic Should be: 2012 - Muzeum moderního umění, Olomouc, Czech Republic

Dev details: 1) There is index.html page with javascript file, which loads data via AJAX (calls PHP file) 2) index.html file has content-type set to UTF-8 3) all files are UTF-8 encoded 4) javascript injects innerHTML using XMLHttpRequest class with responseText 5) php file has header( Content-type: text/html;charset=UTF-8" );

这里:

Have similar (or same) problem, but with spanish characters. I have set Apache to use UTF-8 I have set php header( Content-Type: text/html; charset=utf-8 ); I have set html I have set html But Chorme (only Chrome, FF, IE, etc work ok) shows this:

[Post headers] ... Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 ... [Some random post value from the form] ------WebKitFormBoundary0wi0NAscQiUkF2hJ Content-Disposition: form-data; name="s_name" Oxígeno 100.4 FM Bogotá <-- characters are wrong! should read: Oxígeno 100.4 FM Bogotá

Original Post

最佳回答

我也存在同样的问题。

基本上,就我而言,这是由于浏览器发出的申请负责人发出的。

chrome sends: Content-Type:application/x-www-form-urlencoded, only.
firefox sends: Content-Type:application/x-www-form-urlencoded; charset=UTF-8

Without the charset=UTF-8, the server defaults to ISO, and decodes its wrongly.

问题回答

在实验室主机中,你“在座标结束前”有额外功能。 应当:

<?php
header( Content-type: text/html; charset=utf-8 );




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签