Backport #4279
closed
String#unpack('M') always results US-ASCII encoded string
Added by phasis68 (Heesob Park) about 13 years ago.
Updated almost 13 years ago.
Description
=begin
$ irb
irb(main):001:0> "=C6=F7".unpack('M*')
=> ["\xC6\xF7"]
irb(main):002:0> "=C6=F7".unpack('M*')[0].encoding
=> #Encoding:US-ASCII
irb(main):003:0> "=C6=F7".unpack('M*')[0].valid_encoding?
=> true
irb(main):004:0> "\xC6\xF7".encoding
=> #Encoding:EUC-KR
irb(main):005:0> "\xC6\xF7".valid_encoding?
=> true
=end
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r30542.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport192
- Category changed from core to core
- Status changed from Closed to Assigned
- Assignee set to yugui (Yuki Sonoda)
- Target version deleted (
2.0.0)
"\xC6\xF7" is not ascii only.
$ ruby-1.9.2 -v -e 'p "=C6=F7".unpack("M*")[0].ascii_only?'
ruby 1.9.2p188 (2011-03-28 revision 31204) [x86_64-linux]
true
- Status changed from Assigned to Closed
This issue was solved with changeset r31852.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merges r30542 from trunk into ruby_1_9_2. Fixes #4279.¶
- pack.c (pack_unpack): the resulted string of unpack('M') must have
ASCII-8BIT encoding (and ENC_CODERANGE_VALID). [ruby-core:34482]
Also available in: Atom
PDF
Like0
Like0Like0Like0