Ms7 Search
Google 搜尋 翻譯
calendar
« 九月 2024 »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
近期文章
文章分類
網站連結
Syndicate

« | »

ajax 與中文

2008-08-25 @ 21:38 in PHP, JavaScript, Sql

20080825 shyong

今天在試寫第一個用 php 程序的簡單 ajax  應用時,在中文部分一直傳回亂碼,後來查 Google  才知,因為編碼原因,

  1. Server 端傳回時必須先告知編碼 ,即先送出 :  header('Content-Type:text/html;charset=big5');
  2. Client  端傳送須先 URI 編碼 : var url = "url.php?name=" + encodeURIComponent(value);

Server 端測試可以,Client 等有用到再試

20080828 shyong

測試 Client 端送中文參數一直不行,後來在網上查到以下做法,測試後可行

  1. 在 Client 送參數時,不管是 Get 或 Post,都不要加編碼,即前面不要用 escape 或 encodeURIComponent 之類的編碼,直接送出
    如下: Get => var url = "cl.php?hclass=" + hclass   Post => request.send("hclass="+hclass);
  2. 在 Server 加入  header('Content-Type:text/html;charset=big5');
                        $hclass=iconv( 'UTF-8', 'big5//IGNORE' , $hclass);
  3. 我想應該是 Javascript 傳送是 utf-8 的格式,所以在 Server 端用 iconv 轉換編碼成 big5,再用 big5 格式送出就可以了

 

 

迴響

我只是愛你的有趣博客

我想說,你真的幫助我理解的主題 ajax ??? | ??

作者 seo services vancouver @ 08:02, 2012-03-03

ajax 與中文 | 豬窩

It's especially hard if you are like you're the only teacher in your school to attempt fitting technology into your planning and classroom delivery.

And thanks to some retrofit technology that's on how, it's effectively yesterday.
Silicon is regarded as the common of these materials accustomed to generate electrical current when it's exposed to sunlight.

ajax 與中文 | 豬窩

Fortunately in the current society it's now acceptable that individuals will
most likely change careers and jobs two or three times before
they obtain something that they love, something that they are good at and they
are thrilled to make an appearance to days a week.
Make any final announcements (for instance, the following webinar in a series).

It was foreseen that the variety of 3D printers in homes and
business establishments will increase rapidly.

作者 shinra.ch2tr.com @ 21:27, 2017-05-14

ajax 與中文 | 豬窩

Direct the view returning to your website so they can share their thoughts about
your statement. Dye-sublimation printing is used in medical imaging, polyester fabric printing, and graphic proofing.
But Apple features its own idea about the way to watch video, and possesses absolutely nothing
to do with standards that other people creates.

作者 stepupsite.com @ 11:15, 2017-05-18

ajax 與中文 | 豬窩

Having fun while searching for a soul mate may be the another thing you might
be guaranteed of. Concentrate your pursuit
down to those living around your own personal zip-code .
But for now, this data that they is judging
away from you is either on your side or against you.

作者 www.ae2i-ingenierie.com @ 10:19, 2017-05-20
1 2 3 4 5 6 7 8 9 10  下一篇»
發表迴響
 authimage