--mimepart_4c797caba908b_eed58fbc4a447
Content-Type: text/plain
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

Bug #3758: require Raises Encoding::CompatibilityError for Invalid, Non-ASCII Feature Names
http://redmine.ruby-lang.org/issues/show/3758

Author: Run Paint Run Run
Status: Open, Priority: Low
Category: lib
ruby -v: ruby 1.9.3dev (2010-08-28 trunk 29127) [i686-linux]

When trying to require a feature with a non-ASCII name that does not correspond to an installed gem or a file in $LOAD_PATH, this happens:

  run@paint:~/git/ruby  ./ruby -e 'require "¡ç"'
  <internal:lib/rubygems/custom_require>:33:in `end_with?': incompatible character encodings: ASCII- 8BIT and UTF-8 (Encoding::CompatibilityError)rom <internal:lib/rubygems/custom_require>:33:in `rescue in require'
        from <internal:lib/rubygems/custom_require>:29:in `require'
        from -e:1:in `<main>'

The attached is a simplistic fix, but it assumes both encodings are ASCII-compatible; the elegant solution evades me.


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

--mimepart_4c797caba908b_eed58fbc4a447
Content-Type: text/x-patch; name=custom-require.rb.patch
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename=custom-require.rb.patch

ZGlmZiAtLWdpdCBhL2xpYi9ydWJ5Z2Vtcy9jdXN0b21fcmVxdWlyZS5yYiBi
L2xpYi9ydWJ5Z2Vtcy9jdXN0b21fcmVxdWlyZS5yYgppbmRleCA0ODBjYjdl
Li5hZmFkYzk5IDEwMDY0NAotLS0gYS9saWIvcnVieWdlbXMvY3VzdG9tX3Jl
cXVpcmUucmIKKysrIGIvbGliL3J1YnlnZW1zL2N1c3RvbV9yZXF1aXJlLnJi
CkBAIC0yOCw3ICsyOCw4IEBAIG1vZHVsZSBLZXJuZWwKICAgZGVmIHJlcXVp
cmUocGF0aCkgIyA6ZG9jOgogICAgIGdlbV9vcmlnaW5hbF9yZXF1aXJlIHBh
dGgKICAgcmVzY3VlIExvYWRFcnJvciA9PiBsb2FkX2Vycm9yCi0gICAgaWYg
bG9hZF9lcnJvci5tZXNzYWdlLmVuZF93aXRoPyhwYXRoKQorICAgIG1lc3Nh
Z2UgPSBsb2FkX2Vycm9yLm1lc3NhZ2UKKyAgICBpZiBtZXNzYWdlLmVuZF93
aXRoPyhwYXRoLmZvcmNlX2VuY29kaW5nKG1lc3NhZ2UuZW5jb2RpbmcpKQog
ICAgICAgaWYgR2VtLnRyeV9hY3RpdmF0ZShwYXRoKQogICAgICAgICByZXR1
cm4gZ2VtX29yaWdpbmFsX3JlcXVpcmUocGF0aCkKICAgICAgIGVuZAo-mimepart_4c797caba908b_eed58fbc4a447--