Forum: Ruby-core [ruby-trunk - Bug #8677][Open] $LOAD_PATH did not encoded into the "internal encoding"

Eaddc575a02d805ab3e8777c5ea921d0?d=identicon&s=25 "jiayp@glodon.com (贾 延平)" <jiayp@glodon.com> (Guest)
on 2013-07-24 04:19
(Received via mailing list)
Issue #8677 has been reported by jiayp@glodon.com (贾 延平).

----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 jonforums (Jon Forums) (Guest)
on 2013-07-24 05:00
(Received via mailing list)
Issue #8677 has been updated by jonforums (Jon Forums).


When require fails, is cmd.exe using codepage 936?

What happens when you `chcp 65001` in cmd.exe but do not encode
`$LOAD_PATH` to utf-8?
----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677#change-40636

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
Eaddc575a02d805ab3e8777c5ea921d0?d=identicon&s=25 "jiayp@glodon.com (贾 延平)" <jiayp@glodon.com> (Guest)
on 2013-07-24 05:24
(Received via mailing list)
Issue #8677 has been updated by jiayp@glodon.com (贾 延平).


jonforums (Jon Forums) wrote:
> When require fails, is cmd.exe using codepage 936?
yes
>
> What happens when you `chcp 65001` in cmd.exe but do not encode `$LOAD_PATH` to
utf-8?
require do work with my patch for bug
https://bugs.ruby-lang.org/issues/8676,and the $LOAD_PATH's encoding is
UTF-8.
----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677#change-40638

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 jonforums (Jon Forums) (Guest)
on 2013-07-24 13:23
(Received via mailing list)
Issue #8677 has been updated by jonforums (Jon Forums).


> > What happens when you `chcp 65001` in cmd.exe but do not encode `$LOAD_PATH`
to utf-8?
> require do work with my patch for bug https://bugs.ruby-lang.org/issues/8676,and
the $LOAD_PATH's encoding is UTF-8.

OK. But do either of these also fix this failure?
1) `chcp 65001` in cmd.exe, or
2) use powershell

I'm curious whether those quick non-ruby changes also work; simple
workarounds that don't require your patch + $LOAD_PATH encoding tweak.
----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677#change-40648

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
Eaddc575a02d805ab3e8777c5ea921d0?d=identicon&s=25 "jiayp@glodon.com (贾 延平)" <jiayp@glodon.com> (Guest)
on 2013-07-24 16:18
(Received via mailing list)
Issue #8677 has been updated by jiayp@glodon.com (贾 延平).


jonforums (Jon Forums) wrote:
> > > What happens when you `chcp 65001` in cmd.exe but do not encode `$LOAD_PATH`
to utf-8?
> > require do work with my patch for bug
https://bugs.ruby-lang.org/issues/8676,and the $LOAD_PATH's encoding is UTF-8.
>
> OK. But do either of these also fix this failure?
> 1) `chcp 65001` in cmd.exe, or
> 2) use powershell
>
> I'm curious whether those quick non-ruby changes also work; simple workarounds
that don't require your patch + $LOAD_PATH encoding tweak.

chcp 65001 can make the $LOAD_PATH encoding to UTF-8,and use powershell
need chcp too.
The patch I mentioned in the other issue is to fix the require path with
UTF-8 encoding and NON-ASCII name,and without this patch the $LOAD_PATH
is UTF-8 encoding and the required file is UTF-8 encoding too,But can
not load file.

----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677#change-40652

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
Eaddc575a02d805ab3e8777c5ea921d0?d=identicon&s=25 "jiayp@glodon.com (贾 延平)" <jiayp@glodon.com> (Guest)
on 2013-08-11 08:20
(Received via mailing list)
Issue #8677 has been updated by jiayp@glodon.com (贾 延平).

File loadpath.patch added

Submit a patch to use rb_str_encode_ospath encode $LOADPATH
----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677#change-41083

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
E5fa308f01c66b3e67773422edf1473a?d=identicon&s=25 "jiayp@glodon.com (贾 延平)" <yanping_jia@hotmail.com (Guest)
on 2013-09-25 05:13
(Received via mailing list)
Issue #8677 has been updated by jiayp@glodon.com (贾 延平).


Hope fix in Ruby 2.1
----------------------------------------
Bug #8677: $LOAD_PATH did not encoded into the "internal encoding"
https://bugs.ruby-lang.org/issues/8677#change-41965

Author: jiayp@glodon.com (贾 延平)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p277 (2013-07-23 revision 42121) [i386-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When I use utf-8 as the internal encoding, and I require some file with
Chinese name,and the require failure with:
(({E:/code/rubyinstaller-master/sandbox/ruby19_mingw/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
`require': incompatible character encodings: UTF-8 and GBK
(Encoding::CompatibilityError)}))

I encode the $LOAD_PATH to utf-8 encoding And the problem gone.

So I think we should encoding the $LOAD_PATH into the internal encoding.

Is it right?
If so,I will try to create a patch.I not,please tell me the right way.

thanks a lot
=end
This topic is locked and can not be replied to.