Forum: Ruby-core [ruby-trunk - Bug #9073][Open] Array#join encoding problem

F6c4d3d29ce69f9e558f0bca516a674f?d=identicon&s=25 "046569 (瀚林 李)" <046569@gmail.com> (Guest)
on 2013-11-02 03:43
(Received via mailing list)
Issue #9073 has been reported by 046569 (瀚林 李).

----------------------------------------
Bug #9073: Array#join encoding problem
https://bugs.ruby-lang.org/issues/9073

Author: 046569 (瀚林 李)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.1.0dev (2013-09-22 trunk 43011) [x86_64-darwin13.0.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


a=['hello']
a.push 'kitty'.force_encoding('ASCII-8BIT')
puts a.join
=> hellokitty

a=['问题']
a.push '错误'.force_encoding('ASCII-8BIT')
puts a.join
=> incompatible character encodings: UTF-8 and ASCII-8BIT
(Encoding::CompatibilityError)
=> 问题错误(I expect)
some gems return ASCII-8BIT so I had to encoding everyone.
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2013-11-02 04:56
(Received via mailing list)
Issue #9073 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Third Party's Issue

Bugs in gems return ASCII-8BIT strings.
----------------------------------------
Bug #9073: Array#join encoding problem
https://bugs.ruby-lang.org/issues/9073#change-42725

Author: 046569 (6569 04)
Status: Third Party's Issue
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.1.0dev (2013-09-22 trunk 43011) [x86_64-darwin13.0.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


a=['hello']
a.push 'kitty'.force_encoding('ASCII-8BIT')
puts a.join
=> hellokitty

a=['问题']
a.push '错误'.force_encoding('ASCII-8BIT')
puts a.join
=> incompatible character encodings: UTF-8 and ASCII-8BIT
(Encoding::CompatibilityError)
=> 问题错误(I expect)
some gems return ASCII-8BIT so I had to encoding everyone.
This topic is locked and can not be replied to.