• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unicode & Platform's default character encoding

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
expectation is the root of all heartache - shakespeare. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic