You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by gg...@apache.org on 2004/01/09 20:02:47 UTC

cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/net URLCodec.java

ggregory    2004/01/09 11:02:47

  Modified:    codec/src/java/org/apache/commons/codec/net URLCodec.java
  Log:
  PR: 25995
  Obtained from: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25995
  Submitted by:	olegk@apache.org (Oleg Kalnichevski)
  Reviewed by:	Gary D. Gregory
  
  Revision  Changes    Path
  1.13      +8 -8      jakarta-commons/codec/src/java/org/apache/commons/codec/net/URLCodec.java
  
  Index: URLCodec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/net/URLCodec.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- URLCodec.java	2 Jan 2004 07:01:47 -0000	1.12
  +++ URLCodec.java	9 Jan 2004 19:02:47 -0000	1.13
  @@ -89,16 +89,17 @@
    * @since 1.2
    * @version $Id$
    */
  -
   public class URLCodec 
           implements BinaryEncoder, BinaryDecoder, 
                      StringEncoder, StringDecoder 
   {
       
  +    private final static String US_ASCII = "US-ASCII";
  +    
       /**
        * The <code>String</code> encoding used for decoding and encoding.
        */
  -    protected String encoding = "US-ASCII";
  +    protected String encoding = "UTF-8";
       
       /**
        * BitSet of www-form-url safe characters.
  @@ -265,7 +266,7 @@
           if (pString == null) {
               return null;
           }
  -        return new String(encode(pString.getBytes(encoding)), this.getEncoding());
  +        return new String(encode(pString.getBytes(encoding)), US_ASCII);
       }
   
   
  @@ -282,7 +283,7 @@
               return null;
           }
           try {
  -            return new String(encode(pString.getBytes()), this.getEncoding());
  +            return encode(pString, this.encoding);
           } catch(UnsupportedEncodingException e) {
               throw new EncoderException(e.getMessage());
           }
  @@ -307,7 +308,7 @@
           if (pString == null) {
               return null;
           }
  -        return new String(decode(pString.getBytes(this.getEncoding())), encoding);
  +        return new String(decode(pString.getBytes(US_ASCII)), encoding);
       }
   
   
  @@ -324,12 +325,11 @@
               return null;
           }
           try {
  -            return new String(decode(pString.getBytes(this.getEncoding())));
  +            return decode(pString, this.encoding);
           } catch(UnsupportedEncodingException e) {
               throw new DecoderException(e.getMessage());
           }
       }
  -
   
       /**
        * Encodes an object into its URL safe form. Unsafe characters are 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org