GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX (Contractors): Encoding instructions unclear? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX (Contractors): Encoding instructions unclear?" Watch "NX (Contractors): Encoding instructions unclear?" New topic
Author

NX (Contractors): Encoding instructions unclear?

David Lindquist
Greenhorn

Joined: Jul 22, 2003
Posts: 6
Hello Everyone,
When describing the data format, the instructions state:
All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.

US ASCII is a 7-bit encoding. Should I be using ISO 8859 instead?
Also, when I do a hexdump of the db file I get the following:

It shows that fields are space terminated (0x20) and not null terminated (0x00). I assume that the instructions are using "null terminated" loosely, but I just want to make sure I am not overlooking something critical. How did you all interpret this?
David Lindquist
Greenhorn

Joined: Jul 22, 2003
Posts: 6
Whoops, sorry folks. I should have done a search on this topic before I posted. I just found a plethora of previous posts discussing this.
Vlad Rabkin
Ranch Hand

Joined: Jul 07, 2003
Posts: 555
Hi,
There is a standard encoding "US-ASCII", which is supported by standard jdk.
It shows that fields are space terminated (0x20) and not null terminated (0x00). I assume that the instructions are using "null terminated" loosely, but I just want to make sure I am not overlooking something critical. How did you all interpret this?

Take a look at the thread in the past.
There several solutions:
Some people have just ignored issue with null-terminated string, some did it, since it is still valid operation to save a record containing space charachters (e.g. client sends update request isntead of "abc" , "abc ".
I save records filled with blanks on the rest, but if built in a parser for read in case an other programm writes null-terminated string in the data file.
Vlad
 
GeeCON Prague 2014
 
subject: NX (Contractors): Encoding instructions unclear?