开发者

problem with codification charset

开发者 https://www.devze.com 2023-02-21 16:02 出处:网络
i havethis example (works in chrome with correct codification, but not in the others browsers) http://emprego.xtreemhost.com/slide/

i have this example (works in chrome with correct codification, but not in the others browsers)

http://emprego.xtreemhost.com/slide/

how开发者_JS百科 i can solve this? i put the `charset=ISO-8859-1" for the index and the externals html. The problem is the load() method i think

any help? ps: already tried with utf8 thanks!!


If I access abc.htm as:

http://emprego.xtreemhost.com/slide/abc.htm

then my browser correctly guesses that it is encoded as Latin-1 (AKA ISO-8859-1) but it looks like it is interpreted as UTF-8 when you .load it. If you load abc.htm and play around with the "text encoding" menu (probably under "view" somewhere) in your browser you should see how it appears when interpreted as different encodings.

Have a look at the headers that come back when you load abc.htm:

Content-Type: text/html

And abc.htm does not specify any particular encoding so it is up to the browser to make a guess. You want your Content-Type to look like this:

Content-Type: text/html; charset=iso-8859-1

so that the browser knows what encoding it is dealing with.

I'd convert everything to UTF-8 and arrange to have the character specified in the HTML files and in the Content-Type header.


Put this code on top of the script

$(function() {$.ajaxSetup({beforeSend : function(xhr){xhr.overrideMimeType('text/html; charset=Windows-1250');}});});
0

精彩评论

暂无评论...
验证码 换一张
取 消