From: Izidor Jerebic Date: 2006-06-26T13:51:33+09:00 Subject: Re: Unicode roadmap? On 26.6.2006, at 5:01, Yukihiro Matsumoto wrote: > I still don't see how separate types and behaviors would be more > logical and break far less. For example, if I want to check EXIF > conformance of a jpeg file, I do > > def self.exif_file? (filename) > exif_header = "\xff\xd8\xff\xe1" > magic = File.open(filename) {|f| f.read(4) } > magic == exif_header > end > > I am not sure what you expect about separation, but I doubt separation > would make above code to "be more logical and break far less". Above code assumes all file operations return byte arrays. What is the code when we want to obtain String of characters? What if there is some $KCODE (or equivalent) setting somewhere in the program before these lines? What would be the effect of that? The problem is the auto-magic encoding handling which is required to have text processing be as simple as it is now. You can have either text processing (which adds encoding handling for us, combines bytes in characters etc.) or byte processing (which does not). How do we distinguish between the two modes of operation? The obvious way is by adding a ByteArray. But maybe there is better way... izidor