• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Charset for 8-bit US ASCII ? (BETA)

 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
US ASCII is correct. You cannot write 7 bits.
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic