Cause there are mainly two reasons for

1 XTMLHTTP data returned by the default character encoding is utf-8, if the front desk page is gb2312 or other coded data will generate the code
2 post method to submit data to the default character encoding is utf-8, if the background is gb2312 or other coded data will generate the code

solution

recommended in further consolidation method, the front desk background in utf-8, so can save a lot of trouble, fundamentally solve the problem stil. The advantage is with high efficiency, and conform to the current form, the utf-8 encoding itself is a relatively good code, no language limit. Weakness can only call your backend code or other utf-8 encoding.
the front desk to change for
program program code
<Meta HTTP - equiv="content-type" Content="text/HTML; charset=utf-8" >

background asp first line add the following code to the
program program code
<% @ LANGUAGE="JAVASCRIPT" CODEPAGE="65001" % >
<% the Response. The Charset="utf-8"; % >
<% the Session. The CodePage=65001; % >

the background if you have HTML code also need to ensure the
program program code
<Meta HTTP - equiv="content-type" Content="text/HTML; charset=utf-8" >


remedial method is encoding conversion. Can be in the client on the server side code conversion. Advantage is without any limitation, shortcomings inefficient.


Trackback: http://tb.blog.csdn.net/TrackBack.aspx? PostId=772650

you might be interested in the article:

  • PHP Ajax garbled
  • Ajax garbled new solution
  • Ajax Chinese garbled various solution summary
  • Ajax Chinese garbled the perfect solutions in PHP
  • Ajax + PHP Chinese garbled solution
  • Ajax at the time of Post Chinese garbled solution
  • Ajax Chinese garbled question solution


This concludes the body part