Project

General

Profile

Actions

Bug #1683

closed

Invalid Source Encodings Raise Vauge Errors

Bug #1683: Invalid Source Encodings Raise Vauge Errors

Added by runpaint (Run Paint Run Run) almost 17 years ago. Updated almost 15 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-06-21 trunk 23774) [i686-linux]
Backport:
[ruby-core:24006]

Description

=begin
If a non-ASCII compatible source encoding is specified via a magic comment an ArgumentError is raised.

 $ ruby -vr/tmp/proxy -e 'p 1'
 ruby 1.9.2dev (2009-06-21 trunk 23774) [i686-linux]
 /tmp/proxy.rb:1:in `require': UTF-16BE is not ASCII compatible (ArgumentError)
from /tmp/proxy.rb:1:in `<top (required)>'
from ruby:0:in `require'

There two main problems here:

  1. The problematic magic comment is actually in a file that /tmp/proxy.rb requires, but the error message does not explain this. Especially when using third-party code, it's pretty critical to at least know the file where the error occurs. (Note that when one of the required files has syntax errors, for example, the correct filename and line number is shown).
  2. For somebody unfamiliar with encodings, this error makes little sense. Naming an ASCII-compatible encoding would be helpful.
    =end
Actions

Also available in: PDF Atom