[MacRuby-devel] String performance (yet another)

Vincent Isambart vincent.isambart at gmail.com
Tue Jan 18 17:56:23 PST 2011


>  File.read("test.txt").force_encoding("UTF-16LE").split("\n")
>
> This script returns an error (Encoding::CompatibilityError) even with declaring char code at the beginning or the encoding of the file being UTF-16LE.

MacRuby completely ignores the encoding of the file (it always reads
source files as UTF-8).
So you would probably have to do split("\n".encode("UTF-16LE"))


More information about the MacRuby-devel mailing list