Project

General

Profile

Backport #4279

String#unpack('M') always results US-ASCII encoded string

Added by phasis68 (Heesob Park) over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:34482]

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

Associated revisions

Revision 60d976b3
Added by yugui (Yuki Sonoda) about 8 years ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 31852
Added by yugui (Yuki Sonoda) about 8 years ago

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]

History

#1

Updated by naruse (Yui NARUSE) over 8 years ago

  • 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

#2

Updated by nobu (Nobuyoshi Nakada) about 8 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk 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

#3

Updated by yugui (Yuki Sonoda) about 8 years ago

  • 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