From: Curt Sampson Date: 2002-08-01T19:44:18+09:00 Subject: Re: Unicode in Ruby now? On Thu, 1 Aug 2002, Yukihiro Matsumoto wrote: > Reasonable. How do you want to specify the reading/writing charset? Well, what Java does works fine for me. Basically, java has "streams" which do binary I/O, and "readers/writers" which do character I/O. So to do character I/O, you hand your InputStream or OutputStream to a class that implements the InputReader or OutputWriter interface, and does the charecter encoding conversion. Typically methods that open files or whatever and return a reader or writer will have two signatures: one which uses the "system default" character encoding (set by the locale when you start the JVM), and the other where you can explicitly specify the character encoding as a parameter. This makes it easy to write "auto-sensing" InputReaders, too; so long as they can read enough in advance of the first read from the consumer, they can buffer it and look to see if it's, for example, Shift_JIS versus EUC-JP. But I'd be open to other ways of doing this, too. BTW, I'd prefer to use the term "character encoding" rather than "character set," as technically, the character set is just the characters themselves, and not their assigment to binary numbers or number sequences. Also, it would probably be best to use the IANA standards for character encoding (though they call them "character sets") names, available at http://www.iana.org/assignments/character-sets cjs -- Curt Sampson +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're all light. --XTC