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 與中文 | 豬窩

They are not new text messaging acronyms - they are actually acronyms for gaming this also article will
almost certainly expose you to many of the more prevalent forms.
Let's start our discussion with where we can find this kind of videos.
On another hand, Queensland has shown a tremendous span of spending in last number of
years.

作者 http://Cue.sticky.live/ @ 15:58, 2019-11-21

ajax 與中文 | 豬窩

You should not just join one site but a few instead, like that you've got a variety of members to pick
from. The online dating sites arena has exploded immensely as more people are counting
on internet in order to meet new people, find their
special someone, friendship and more activities. The choice is yours, would
you wants to share your current email address contact information, your telephone numbers, your address and in many cases your surname.

作者 Alphonse @ 05:00, 2019-11-30

ajax 與中文 | 豬窩 | 4

Having read this I believed it was very enlightening.
I appreciate you spending some time and effort to put this content together.
I once again find myself spending a lot of time both reading and leaving comments.
But so what, it was still worthwhile!

作者 Sophia @ 04:58, 2019-12-13

ajax 與中文 | 豬窩

They also have scratch games, that they call Skratch card games, because they have altered these
games to include a level of skill and also have a bonus rounds.

Let's start our discussion with where we can easily find such videos.
The expansion of internet games has actually shown the growth and development
of pc networks from small regional networks for the
web as well as the growth and development of net accessibility
itself.

作者 Mere.Wiree.world @ 06:45, 2020-01-11

ajax 與中文 | 豬窩

Of course, should you choose a totally free site, you will get over social contact based upon your mood as
well as the friends you make on each site. If
things walk out of hand then leave immediately and change your username.
Once they are successful inside their career and accomplish what you want, they realize the significance of marriage.

作者 http://Fjce.Alluwant.info @ 13:55, 2020-01-17
發表迴響
 authimage