ajax 與中文
20080825 shyong
今天在試寫第一個用 php 程序的簡單 ajax 應用時,在中文部分一直傳回亂碼,後來查 Google 才知,因為編碼原因,
- Server 端傳回時必須先告知編碼 ,即先送出 : header('Content-Type:text/html;charset=big5');
- Client 端傳送須先 URI 編碼 : var url = "url.php?name=" + encodeURIComponent(value);
Server 端測試可以,Client 等有用到再試
20080828 shyong
測試 Client 端送中文參數一直不行,後來在網上查到以下做法,測試後可行
- 在 Client 送參數時,不管是 Get 或 Post,都不要加編碼,即前面不要用 escape 或 encodeURIComponent 之類的編碼,直接送出
如下: Get => var url = "cl.php?hclass=" + hclass Post => request.send("hclass="+hclass); - 在 Server 加入 header('Content-Type:text/html;charset=big5');
$hclass=iconv( 'UTF-8', 'big5//IGNORE' , $hclass); - 我想應該是 Javascript 傳送是 utf-8 的格式,所以在 Server 端用 iconv 轉換編碼成 big5,再用 big5 格式送出就可以了
迴響
ajax 與中文 | 豬窩
Assuming you do not belong to that category, you'll need
to be honest with yourself. Free Profile - Most dating services will help you to develop
a free profile. Talk the Talk - There is a certain type of talk
that men do, actually comfortable with.
ajax 與中文 | 豬窩
Of course, in the event you choose a free site, you
will get over social contact based on your mood along with the
friends you make on each site. These scammers usually just have one picture in their profile,
thus it could be the norm for many experienced individuals
who date online to feel that one picture profiles don't show
the real person. The choice is all yours, would you would like to
share your current current email address, your telephone numbers, your address and in many cases
your surname.
ajax 與中文 | 豬窩
They also have scratch cards, they will call Skratch games, given that they
have altered these games to include a level of skill this
will let you bonus rounds. It is quite latest internet
betting, which is obtaining a lots of popularity among youngsters coming from all areas of life, young
adults and older people. This has get to be
the most favored selection for everyone that likes excitement.
ajax 與中文 | 豬窩
Males can discover the female of their choice easily through free dating sites.
The online dating arena has grown immensely weight
loss individuals are relying on internet to fulfill new
people, find their special someone, friendship and much more activities.
You have complete control you want to make contact with and which team you need to block
from.
ajax 與中文 | 豬窩
If you attempt to work with those secrets while using
internet dating opportunities then you've more chances to get your date partner.
Now, there's nothing to bother with because internet world
and internet dating services have eradicated this trouble.
Meeting web dating is tricky being honest causes it to be much easier.