re:Java and UTF

From: Pierre Lewis (lew@nortel.ca)
Date: Wed Jul 02 1997 - 12:45:00 EDT


In message "Java and UTF", 'dank@alumni.caltech.edu' writes:

> > I know about these, and, because they also store the length (a binary
> >number), they're useless for, say, a Unicode plain-text editor.

> No, they're still quite useful; you just have to strip off the
> length. Use a memory stream rather than a file stream,
> strip off the two extra bytes, and write the buffer to disk. Voila!

Na ja, sure it can be done, but that's too much of a hack for me (not
to mention wasted resources).

Btw, what is this length? The internal length or the length of the
UTF-8 stream? Because, of course, to use
java.io.DataInputStream.readUTF(), you would have to regenerate it.

> it's fair to say that Java can do UTF, and you can write a UTF-8
> plain text editor in it without too much fuss.

No problem with that. UTF-8 processing is just a couple of pages. But
I'm still surprised (and waiting to be proven worng) that the JDK
doesn't offer a class to do this directly (without the hack mentioned
above).

Pierre



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:35 EDT