ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Youngho Cho" <youn...@nannet.co.kr>
Subject Re: Passing non-ASCII String value - Again
Date Thu, 07 Oct 2004 02:59:56 GMT
Hello,
Thanks for your reply.

I successfully pass the the Korean Character round-trip test 
with current CVS version which is patched from the atlassian.
( with common-codec-1.2 )

Thanks,

Youngho

----- Original Message ----- 
From: "Shirai,Kaoru" <shirai@korinkan.co.jp>
To: <xmlrpc-user@ws.apache.org>; <youngho@nannet.co.kr>
Sent: Thursday, October 07, 2004 10:32 AM
Subject: Re: Passing non-ASCII String value - Again


> >  Does we need another patch ?
> 
> 1. Try to insert this code before creating XmlRpcClient:
> 
>   XmlRpc.setEncoding("UTF8");
> 
> 2. Otherwise, how about this patch (string-utf8.diff)?
>    ( Note: This patch also requires XmlRpc.setEncoding("UTF8") )
> -- 
> Shirai,Kaoru <shirai@korinkan.co.jp>
> Korinkan Ltd. - http://www.korinkan.co.jp/
> 


--------------------------------------------------------------------------------


> Index: src/java/org/apache/xmlrpc/XmlRpc.java
> ===================================================================
> RCS file: /home/cvspublic/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpc.java,v
> retrieving revision 1.37
> diff -u -r1.37 XmlRpc.java
> --- src/java/org/apache/xmlrpc/XmlRpc.java 30 Jun 2004 06:11:55 -0000 1.37
> +++ src/java/org/apache/xmlrpc/XmlRpc.java 7 Oct 2004 01:31:24 -0000
> @@ -56,6 +56,7 @@
>   */
>  
>  import java.io.InputStream;
> +import java.io.InputStreamReader;
>  import java.util.Hashtable;
>  import java.util.Stack;
>  import java.util.Vector;
> @@ -387,6 +388,7 @@
>       */
>      synchronized void parse(InputStream is) throws Exception
>      {
> +        InputStreamReader reader = new InputStreamReader(is, "UTF8");
>          // reset values (XmlRpc objects are reusable)
>          errorLevel = NONE;
>          errorMsg = null;
> @@ -440,7 +442,7 @@
>          }
>          try
>          {
> -            parser.parse(new InputSource (is));
> +            parser.parse(new InputSource (reader));
>          }
>          finally
>          {
> Index: src/java/org/apache/xmlrpc/XmlWriter.java
> ===================================================================
> RCS file: /home/cvspublic/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlWriter.java,v
> retrieving revision 1.11
> diff -u -r1.11 XmlWriter.java
> --- src/java/org/apache/xmlrpc/XmlWriter.java 30 Jun 2004 18:46:58 -0000 1.11
> +++ src/java/org/apache/xmlrpc/XmlWriter.java 7 Oct 2004 01:31:24 -0000
> @@ -335,11 +335,6 @@
>              char c = text.charAt (i);
>              switch (c)
>              {
> -            case '\t':
> -            case '\r':
> -            case '\n':
> -                write(c);
> -                break;
>              case '<':
>                  write(LESS_THAN_ENTITY);
>                  break;
> @@ -350,8 +345,16 @@
>                  write(AMPERSAND_ENTITY);
>                  break;
>              default:
> -                if (c < 0x20 || c > 0xff)
> -                {
> +                boolean badChar = false;
> +                switch (c) {
> +                case '\t':
> +                case '\r':
> +                case '\n':
> +                    break;
> +                default:
> +                    badChar = (c < 0x20);
> +                }
> +                if (badChar) {
>                      // Though the XML-RPC spec allows any ASCII
>                      // characters except '<' and '&', the XML spec
>                      // does not allow this range of characters,
> @@ -361,10 +364,7 @@
>                                                "corresponding to XML entity &#" +
>                                                String.valueOf((int) c) + ';', null);
>                  }
> -                else
> -                {
> -                    write(c);
> -                }
> +                write(c);
>              }
>          }
>      }
> 
Mime
View raw message