This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I've noticed the following behaviour when writing out to my 8 byte rate (holds a price and currency symbol) field:
when I set the String value to be $49.99, everything is as expected.
when I set the String value to be E49.99 (where the E is actually the euro symbol - it doesnt show up on this forum when typed), the fields following the rate field overflow into their subsequent fields.
I guess that the problem is that the Euro currency symbol uses more bytes than the $ symbol. So this leads me to believe that I need to check the amount of bytes a String is using before I persist it to the database. I did not see any mention of this in DennysDVDs or in the Monkhouse book. So is there something else I could consider?
Perhaps I need to explicitly set the encoding of the data before I persist it to the database? Again, I have not heard mention of this before either on here or in the book. I see where the encoding is set to UTF-8 when reading from the database in DennysDvds, but not when writing to the db.
Can someone please point me in the right direction?