This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I am splitting a string [which could be composed of multibyte characters] in to chunks of 4000 bytes [so that i could store it in to varchar2 column in the database]. so i do "new String(bytes, currentPos, 4000);".
The issue: A multibyte character could be broken due to splitting based on bytes.
Question: how can i find out that the last byte in the 4000 bytes string is a part of a multibyte sequence, so that i don't split it up and should construct a smaller string [say 3997 bytes, avoiding splitting the last 3 byte multibyte char]
A multibyte character could be broken due to splitting based on bytes.
Before doing anything drastic, exactly how does this database field get used? If all the bytes are reassembled before converting back to String, the multibyte char will be restored and there is no problem.
Joined: Mar 12, 2004
Originally posted by William Brogden:
Before doing anything drastic, exactly how does this database field get used? If all the bytes are reassembled before converting back to String, the multibyte char will be restored and there is no problem. Bill
The issue is this field is a varchar2, so we store string splitted in to multiple rows of 4000 bytes.
so what i am doing is something like :
so step 2 may result in the multibyte character being splitted .
Author and all-around good cowpoke
Joined: Mar 22, 2000
Who cares if the multibyte sequence is split?
I'm serious - do you ever use just one chunk of bytes or do you always put them back together? Your point 4 says you never use just one.
If you never try to turn a single isolated chunk of bytes into a String you never get any problem.