• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Unicode & Platform's default character encoding

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • 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 ?
 
Desperado
Posts: 3226
5
  • 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
  • Mark post as helpful
  • 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 ?
 
Maybe he went home and went to bed. And took this tiny ad with him:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!