• 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

Charset for 8-bit US ASCII ? (BETA)

 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For BETA exam
http://java.sun.com/j2se/1.4/docs/api/java/nio/charset/Charset.html
Just had some doubt as to what it was because the above document says that "US ASCII" is 7-bit ASCII. I'm inclined to use ISO-8859-1 because it's 8-bit
I think it is incorrect to use writeUTF because it prepends two bytes of length information before the string representation. To me, this will violate the data file format specification.
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
US ASCII is correct. You cannot write 7 bits.
 
Junilu Lacar
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I take it back. writeUTF is appropriate to use for the header/schema information. I was just making it harder on myself than I needed to by explicitly writing the two-byte length info when the writeUTF takes care of this for me. :roll: I still think I can't use writeUTF with the data though because my requirements specify "no separators between fields, each field fixed length at maximum specified in schema...all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field."
[ October 03, 2002: Message edited by: Junilu Lacar ]
 
Junilu Lacar
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got word back from Sun about this. Max Habibi was right: there was a typo in the instructions and it should read "7-bit US ASCII" instead of "8-bit US ASCII".
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic