You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Jason Height <jh...@minotaur.apache.org> on 2005/08/25 01:58:36 UTC

Re: String Encoding (again)

Andy,

So if i did an audit over the code and made sure that getBytes() is not 
called without specifying an encoding ie getBytes("UTF-16LE") then 
everything should be sweet.

UnicodeRecord does specifying an encoding when it is about to serialize 
the string bytes, so it shoud perform the translation from whatever the 
string default encoding is, into the required encoding.

Jason



http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#getBytes()

public byte[] getBytes()

      Encodes this String into a sequence of bytes using the platform's
default charset, storing the result into a new byte array.

      The behavior of this method when this string cannot be encoded in
the default charset is unspecified. The CharsetEncoder class should be
used when more control over the encoding process is required.

      Returns:
          The resultant byte array
      Since:
          JDK1.1


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Re: String Encoding (again)

Posted by an...@superlinksoftware.com.
kinda...but...also have to worry about construction

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[],%20int,%20int)
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[])


Jason Height wrote:
> Andy,
> 
> So if i did an audit over the code and made sure that getBytes() is not 
> called without specifying an encoding ie getBytes("UTF-16LE") then 
> everything should be sweet.
> 
> UnicodeRecord does specifying an encoding when it is about to serialize 
> the string bytes, so it shoud perform the translation from whatever the 
> string default encoding is, into the required encoding.
> 
> Jason
> 
> 
> 
> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#getBytes()
> 
> public byte[] getBytes()
> 
>      Encodes this String into a sequence of bytes using the platform's
> default charset, storing the result into a new byte array.
> 
>      The behavior of this method when this string cannot be encoded in
> the default charset is unspecified. The CharsetEncoder class should be
> used when more control over the encoding process is required.
> 
>      Returns:
>          The resultant byte array
>      Since:
>          JDK1.1
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/