• 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

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
I have a question regarding the following objective of the exam
-----------------------------------------------------------------
THE java.io PACKAGE.
** Write code that uses objects of the classes InputStreamReader and OutputStreamWriter to translate between Unicode and either platform default or ISO 8859-1 character encodings.
** Destinguish between conditions under which platform default encoding conversion should be used and conditions under which a specific conversion should be used.
-----------------------------------------------------------------
I know the following code coverts 8859_5 into unicode characters.
And you could do the opposite using OutputStreamWriter.

FileInputStream fis=new FileInputStream("abc.txt");
InputStreamReader isr=new InputStreamReader(fis,"8859_5");

Now my question is about the second part of the objective.
What is that "Distinguish between" ?
Is it about just using the getEncoding() method to find out what encoding is used in the input/output stream before reading or writing a file (since java is supposed to be platform independent) ?
Is there anything more to it ?
Thanks

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
these days, i also think about this problem.
when i do some encoding conversion according to java tutorial, i found the japanese display uncorrectly. then i get my default encoding it is "GBK", so i output it directly, it display correctly. so maybe because my os, i do not need to convert the char,(just add some font), and you use English os, so when you encounter some char you should determine how it convert to display, i do not know is that the meaning of the clause.
 
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
Moderators,
Any ideas on this ?
I thought since I posted it on sunday nobody noticed.
Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic