Project

General

Profile

This project is closed and read-only.

Actions

Backport #4279

closed

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

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

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

Status:
Closed
[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

Updated by naruse (Yui NARUSE) over 15 years ago Actions #1

  • 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

Updated by nobu (Nobuyoshi Nakada) over 15 years ago Actions #2

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

Updated by yugui (Yuki Sonoda) over 15 years ago Actions #3

  • 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]
Actions

Also available in: PDF Atom