[#23231] What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Dear Ruby developers and users!

8 messages 2009/04/17

[#23318] [Feature #1408] 0.1.to_r not equal to (1/10) — Heesob Park <redmine@...>

Feature #1408: 0.1.to_r not equal to (1/10)

19 messages 2009/04/26

[ruby-core:23208] [Bug #1381] Confusing Encoding Error

From: James Gray <redmine@...>
Date: 2009-04-14 21:32:32 UTC
List: ruby-core #23208
Bug #1381: Confusing Encoding Error
http://redmine.ruby-lang.org/issues/show/1381

Author: James Gray
Status: Open, Priority: Normal
Category: M17N, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-04-13) [i386-darwin9.6.0]

When I reuse a Regexp object, the Encoding seems unchanged but an error message can report something different from what I am seeing:

    $ cat enc_error_bug.rb 
    re = /./
    puts re.encoding.name
    "a".encode("ASCII-8BIT") =~ re if $DEBUG
    puts re.encoding.name
    "a".encode("UTF-16BE") =~ re
    $ ruby enc_error_bug.rb 
    US-ASCII
    US-ASCII
    enc_error_bug.rb:5:in `=~': incompatible encoding regexp match (US-ASCII regexp with UTF-16BE string) (Encoding::CompatibilityError)
    	from enc_error_bug.rb:5:in `<main>'
    $ ruby -d enc_error_bug.rb 
    US-ASCII
    US-ASCII
    Exception `Encoding::CompatibilityError' at enc_error_bug.rb:5 - incompatible encoding regexp match (ASCII-8BIT regexp with UTF-16BE string)
    enc_error_bug.rb:5:in `=~': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-16BE string) (Encoding::CompatibilityError)
    	from enc_error_bug.rb:5:in `<main>'

Notice how the Regexp's Encoding stays US-ASCII, but the error message calls it ASCII-8BIT if I first match it as against an ASCII-8BIT String.


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next