[Ironruby-core] $KCODE and encodings

Shri Borde Shri.Borde at microsoft.com
Fri Feb 13 20:22:48 EST 2009


If I use Notepad2's menu to set the encoding to "UTF8 with signature", and run either "ruby utf8_with_signature.rb" or "ruby -Ku utf8_with_signature.rb", the file fails to parse. The file is attached.

If I save the file with encoding set just as "UTF8", the file is 3 bytes smaller. "ruby utf8.rb" fails, but "ruby -Ku utf8.rb" works. With "-Ku", things work even if I do not have "# -*- coding: utf-8 -*-" in the file.

The repro files are attached.

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Matthew Wilson
Sent: Friday, February 13, 2009 5:11 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] $KCODE and encodings

On Fri, Feb 13, 2009 at 5:01 PM, Shri Borde <Shri.Borde at microsoft.com<mailto:Shri.Borde at microsoft.com>> wrote:
Ruby 1.8 support for encoding:

*         A comment like "# -*- coding: utf-8 -*-" at the start of the file is supposed to determine how to parse a .rb file, but I haven't really figured out how to make this work. Non-ansi characters cause an error while loading the file.

Did the utf-8 file(s) you tried have a BOM or not?

-Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090213/2cc07df2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utf8_with_signature.rb
Type: application/octet-stream
Size: 45 bytes
Desc: utf8_with_signature.rb
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090213/2cc07df2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utf8.rb
Type: application/octet-stream
Size: 42 bytes
Desc: utf8.rb
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090213/2cc07df2/attachment-0001.obj>


More information about the Ironruby-core mailing list