chinese encoding issue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

chinese encoding issue

tayjack-2
Hello, everyone

I have a instance, like this

<xforms:instance id="stockroom-service-parameters">
  <parameters xmlns="">
    <service>fetchStockroom</service>
    <productId>11011</productId>
    <showroomId>701</showroomId>
    <address>中文</address>
  </parameters>
</xforms:instance>

I use submission to send this instance as parameters, like this

<xforms:submission id="stockroom"  ref="instance('stockroom-service-parameters')" resource="/bazaar/app" f:url-norewrite="true" replace="instance" instance="stockroom-options" method="get" separator="&amp;" />

I got this

http://localhost:8888/bazaar/app?service=fetchStockroom&productId=11011&showroomId=701&address=%25E7%25A7

The server side (servlet base) use utf-8 and can't get correct encoding.

How encode chinese character to correct encoding?

thanks for any comment.

jack

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: chinese encoding issue

Alessandro Vernet
Administrator
On Feb 26, 2009, at 7:16 AM, tayjack wrote:

> <xforms:instance id="stockroom-service-parameters">
>   <parameters xmlns="">
>     <service>fetchStockroom</service>
>     <productId>11011</productId>
>     <showroomId>701</showroomId>
>     <address>中文</address>
>   </parameters>
> </xforms:instance>
>
> I use submission to send this instance as parameters, like this
>
> <xforms:submission id="stockroom"  ref="instance('stockroom-service-
> parameters')" resource="/bazaar/app" f:url-norewrite="true"  
> replace="instance" instance="stockroom-options" method="get"  
> separator="&amp;" />
>
> I got this
>
> http://localhost:8888/bazaar/app?service=fetchStockroom&productId=11011&showroomId=701&address=%25E7%25A7
>
> The server side (servlet base) use utf-8 and can't get correct  
> encoding.

I can't reproduce this with nightly builds. Here is the sandbox  
example I created for this: http://pastie.org/401444.txt. The query I  
see going to Twitter search is:

http://search.twitter.com/search?q=%E4%B8%AD%E6%96%87

Have you tested this on a nightly build? Does this example work for you?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: chinese encoding issue

tayjack-2
I figure out where my problem is.

My servlet container is Tomcat.

I add useBodyEncodingForURI="true" in $CATALINA_HOME/conf/server.xml, like this

<Connector port="8080"
           useBodyEncodingForURI="true"/>

thanks for your reply

Jack




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: chinese encoding issue

Alessandro Vernet
Administrator
Jack,

On Feb 27, 2009, at 6:15 PM, tayjack wrote:

> I figure out where my problem is.
>
> My servlet container is Tomcat.
>
> I add useBodyEncodingForURI="true" in $CATALINA_HOME/conf/
> server.xml, like this
>
> <Connector port="8080"
>          useBodyEncodingForURI="true"/>

First, it's great you found a solution. But now, I am trying to  
understand what this is about :).

Tomcat has an attribute URIEncoding on <Connector>. The doc reads:  
This specifies the character encoding used to decode the URI bytes,  
after %xx decoding the URL. If not specified, ISO-8859-1 will be used.

Why use ISO-8859-1 by default? That is strange because my  
understanding is that the encoding for the URI should be UTF-8,  
whatever encoding is used for the body of the response (http://tools.ietf.org/html/rfc3986 
). Shouldn't the default be UTF-8 ? Let me know if you figure this one  
out!

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws