aspose file tools*
The moose likes Java in General and the fly likes Unicode & Platform's default character encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unicode & Platform Watch "Unicode & Platform New topic
Author

Unicode & Platform's default character encoding

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Jan 30, 2000
Posts: 3222
    
    5
"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


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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 ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unicode & Platform's default character encoding