Projects

Ticket #742 (new defect)

Opened 20 months ago

Last modified 14 months ago

Encoding is always UTF-8 (?)

Reported by: watson1978@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby Later
Component: MacRuby Keywords:
Cc:

Description

Test code:

$ cat a.rb    
# coding: us-ascii
p __ENCODING__        #=> #<Encoding:US-ASCII>
p "abc".encoding      #=> #<Encoding:US-ASCII>
p "\x80".encoding     #=> #<Encoding:ASCII-8BIT>

Result on Ruby 1.9.2 preview3:

$ ruby -v a.rb 
ruby 1.9.2dev (2010-05-31 revision 28117) [x86_64-darwin10.3.0]
#<Encoding:US-ASCII>
#<Encoding:US-ASCII>
#<Encoding:ASCII-8BIT>

Result on MacRuby:

$ macruby a.rb                
#<Encoding:US-ASCII>
#<Encoding:UTF-8>
#<Encoding:UTF-8>

When script encoding is "us-ascii", I think that literal encoding should return "ASCII-8BIT".

Change History

Changed 19 months ago by lsansonetti@…

MacRuby doesn't really honor the script encoding setting. It uses UTF-8 by default for pretty much everything. I suspect it's not going to change any time soon, though better compatibility could be added once we approach 1.0.

Changed 18 months ago by watson1978@…

It seems that this issue blocks #849.

Changed 14 months ago by lsansonetti@…

This bug might be needed for 1.0, however I don't know if there are any Ruby libraries around using the encoding: magic comment with something different than utf-8.

Changed 14 months ago by eloy.de.enige@…

Skimming through the search results on github for "# encoding" hasn't revealed any other encodings than utf-8 indeed.

 https://github.com/search?langOverride=&language=ruby&q=%23+encoding&repo=&start_value=6&type=Code&x=0&y=0

Changed 14 months ago by lsansonetti@…

  • milestone set to MacRuby Later

Moving this bug to Later.

Note: See TracTickets for help on using tickets.