oh,my post data is encode correctly,and web page was encoded with
"GBK" that is a general Chinese encoding way.
I recorded my post data via firebug that is a firefox plugin for investigation:

1.request header:
Host    localhost:8080
User-Agent      Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN;
rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Accept  text/javascript, text/html, application/xml, text/xml, */*
Accept-Language zh-cn,zh;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive      300
Connection      close
X-Requested-With        XMLHttpRequest
X-Prototype-Version     1.5.0_pre1
Content-Type    application/x-www-form-urlencoded
my-header-encoding      utf-8
Referer http://localhost:8080/SpringIntergratedRestlet/addressbook.html
Content-Length  73
Pragma  no-cache
Cache-Control   no-cache

2.request(post) data:
json    {"city":"北京","street":"复兴门","zip":"100031","tel":"123456"}
look above, post data was correctly.It's my post data that descipt a
addressbook Object.

3.response header:
Server  Apache-Coyote/1.1, Noelios-Restlet-Engine/1.1.1
Date    Thu, 24 Jan 2008 02:04:18 GMT
Content-Language        *
Content-Type    application/json;charset=UTF-8
Content-Length  66
Connection      close

4.response data:
{"street":"复兴门","zip":100031,"tel":"123456","city":"北京"}
My server return addressbook object with json.

So I think it is cause that using CharSequence(it default uses
unicode) in FormUtil create method.
On Jan 23, 2008 5:19 PM, Rob Heittman <[EMAIL PROTECTED]> wrote:
>
> If I read this correctly, it sounds like your client is posting the data in
> ISO-8859-1 format.
>
> The Form constructor you need is available in the Restlet 1.1 snapshots.
> With this you can say:
>
> Form form = new Form(request.getEntity(),CharacterSet.ISO_8859_1);
>
> You can read the API documentation here.
> http://www.restlet.org/documentation/1.1/api/org/restlet/data/Form.html
>
> Note: the ISO-8859-1 encoding is probably going to do bad things if the data
> contains Chinese characters, so I would get this fixed if you can.  If the
> client is a browser, unless told otherwise, it typically posts a form back
> in the same character set as the page where the request originates.  So if
> your server application generated the form (or the page which contains AJAX
> code that does the POST) you may be able to influence this by setting the
> outgoing character set on the page.
>
>  - Rob
>
>



-- 
cleverpig
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
Phone: 010-66415588-1113
MSN: [EMAIL PROTECTED]
QQ: 149291732
Skepe: cleverpigatmatrix
My Facebook ID:cleverpig
My Blog: hihere.sohu.com
My Tags: del.icio.us/cleverpig
My Twitter: twitter.com/cleverpig
My Organization: www.beijing-open-party.org
一些值得关注的唧歪:
  http://jiwai.de/t/jmatrix/
  http://jiwai.de/t/db4o/
  http://jiwai.de/t/matrix-community/

Reply via email to