[#3228] Core support for Gems, and namespace — "Luke A. Kanies" <luke@...>

Hi all,

21 messages 2004/07/27
[#3230] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Tue, 27 Jul 2004 11:39:08 +0900, Luke A. Kanies <luke@madstop.com> wrote:

[#3234] Re: Core support for Gems, and namespace — "Luke A. Kanies" <luke@...> 2004/07/27

On Tue, 27 Jul 2004, Austin Ziegler wrote:

[#3238] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Wed, 28 Jul 2004 00:14:29 +0900, Luke A. Kanies <luke@madstop.com> wrote:

[BUG] Ruby doesn't ignore Byte Order Mark when run with -Ku

From: Florian Groß <florgro@...>
Date: 2004-07-18 16:40:17 UTC
List: ruby-core #3208
Moin!

I created a file utf8.rb with this content:

C:\>ruby -e "p File.read('utf8.rb')"
"\357\273\277puts \"Hello World\""

The "\357\273\277" part is the Byte Order Mark for UTF-8, my editor 
automatically put it at the beginning of the file, because I saved it as 
UTF-8. I think that many editors will do this so that they can later 
recognize whether the file is encoded in UTF-8 or something else.

See http://www.unicode.org/unicode/faq/utf_bom.html#BOM for further 
explanation of the BOM and what it is used for.

However Ruby doesn't treat it as a signature which means that it isn't 
ignored. If I try to execute the file I get this:

C:\>ruby -Ku utf8.rb
utf8.rb:1: undefined method `ツエ笊冷柏puts' for main:Object (NoMethodError)

I think that Ruby should just ignore a BOM if it occurs at the beginning 
of a script, because in most editors it will not be shown and perhaps 
automatically be attached to the file. (I think that it would confuse 
users if they don't see the BOM, but if Ruby sees it.)

Regards,
Florian Gross


In This Thread

Prev Next