Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ascii validation

 
rinke hoekstra
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The urlybird 1.1.1 assignment says on the database:

The character encoding is 8 bit US ASCII


I'm doubting about doing validation on this for new or updated records.
Do you people check on this?
 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I am not doing any validation on the character set.
I just read from the db file using ISO-Latin and writing in it using the same encoding.
 
rinke hoekstra
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, another try, but a bit more specific:

I was using String.getBytes("US-ASCII") to turn my strings into arrays of bytes, ready to be written to the database file.

However, the java API-doc says on this method:
The behavior of this method when this string cannot be encoded in the default charset is unspecified.


In normal language: when I insert an '�' we don't know what happens (in fact, it will be turned into a '?')

Are people using the same String.getBytes methods? What about this? Ignore the problem? or use java.nio.charset.CharsetEncoder?

Or am I too much lost into details?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic