File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unicode & Platform's default character encoding

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
When r these two encodings used ?
Is it that when Java stores characters on heap in memory, it uses Unicode encoding to represent the
characters, while Platform's Default Character Encoding is used when writing to a file, i.e. on the disk ?
I would like to know what is the meaning of following statement describing this method :
[b]public String(byte[] bytes) [b]
[i]Construct a new String by converting the specified array of bytes using the platform's default character
encoding. [i]
As String uses Unicode to represent characters, where does the platform's default character encoding
come into the picture ?
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Is it that when Java stores characters on heap in memory, it uses Unicode encoding to represent the characters, while Platform's Default Character Encoding is used when writing to a file, i.e. on the disk?"
YES
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Tony,
Does it mean that Unicode is only used to represent characters in memory and not elsewhere ? Say, one Java program is communicating with other Java program over the network. Can the bytes flowing over the network be Unicode representation of the characters ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic