Inputstreamreader is stripping/removing the '/0' character from the input stream when locale is zh_TW.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, May 27, 2004 10:39 PM

I am using the following logic for parsing the input stream. This logic is working fine for all most all locales except zh_TW locale. When the locale is zh_TW somehow '/0' is getting absconding from the string. I have checked newByteArray contains '/0' character. ByteArrayInputStream inStream = new ByteArrayInputStream(newByteArray); InputStreamReader Reader = new InputStreamReader(inStream); StringBuffer theStrBuf = new StringBuffer(); try{ while ((theReader.ready()) && ((theChar = theReader.read()) != -1)) { if (theChar == '\0') { return theStrBuf.toString(); } else { theStrB   More>>

I am using the following logic for parsing the input stream.
This logic is working fine for all most all locales except zh_TW locale.
When the locale is zh_TW somehow '/0' is getting absconding from the string.
I have checked newByteArray contains '/0' character.

			


ByteArrayInputStream inStream = new ByteArrayInputStream(newByteArray);
InputStreamReader Reader = new InputStreamReader(inStream);
StringBuffer theStrBuf = new StringBuffer();
try{
while ((theReader.ready()) && ((theChar = theReader.read()) != -1))
{
if (theChar == '\0')
{
return theStrBuf.toString();
}
else
{
theStrBuf.append((char)theChar);
}
}
throw new StringIndexOutOfBoundsException(myCurrPos);
}



Since '/0' is not appearing in the string exception is generated.    <<Less
About | Sitemap | Contact