You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2002/02/20 23:55:17 UTC

Re: Question about parsing hex data

In message <0674D9B64FE1B04D912243724811E937028C31@bridgeville02.optimum-power.
com>, "Terence P. Quigley" writes:
>The data bounded by <SOM> and <EOM> tags parses fine when the embedded
>data is plain text. =20
>However, when that same data is encrypted (still in ASCII format) the
>expression fails to match.  I've=20
>tried numerous expressions in an attempt to get this working, but with
>no luck.  Any help would be greatly
>appreciated.

You're probably inadvertently interpreting the stream as UTF-8 instead
of straight-up bytes when you convert it to a String.  If you are using
a Reader, use new InputStreamReader(in, "ISO-8859-1") to make sure you
get a one to one mapping of byte values between 0 and 255 to Java
chars.  Otherwise your stream is going to be interpreted as multi-byte
characters and the data you store in your String will not be what you
intend.  It's a good thing you used [\\x00-\\xff]* instead of .*,
otherwise you wouldn't have caught the problem.

daniel



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>