Re: Unicode character transformation through XSLT

From: Pim Blokland (pblokland@planet.nl)
Date: Wed Mar 12 2003 - 13:34:13 EST

  • Next message: John Cowan: "Re: Unicode character transformation through XSLT"

    Jain, Pankaj (MED, TCS) schreef:

    > while((chunk = ipStream.read())!=-1)
    > {
    > byte byChunk = new Integer(chunk).byteValue();
    > strBuf.append((char) byChunk);
    > }

    You don't say which type your "chunk" variable is, but the problem
    is definitely in the number of conversions you do.
    In this tiny piece of code you convert the input from (whatever
    "chunk" is) into Integer, then to byte and finally to char.
    As I understand it, char is a signed 16 bits type in Java; any of
    the others may be unsigned. Hence the problem. You can try stripping
    off the high bits after conversion to char (i.e. (byChunk&127) at
    the end) or try to circumvent all those conversions altogether.

    Pim Blokland



    This archive was generated by hypermail 2.1.5 : Wed Mar 12 2003 - 14:22:40 EST