* [ruby-dev:50755] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate`
[not found] <redmine.issue-15521.20190110062059@ruby-lang.org>
@ 2019-01-10 6:21 ` sue445fukuoka
2019-01-10 6:34 ` [ruby-dev:50756] [Ruby trunk Bug#15521][Closed] " kou
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: sue445fukuoka @ 2019-01-10 6:21 UTC (permalink / raw)
To: ruby-dev
Issue #15521 has been reported by sue445 (Go Sueyoshi).
----------------------------------------
Bug #15521: encoding is missed when using `CSV.generate`
https://bugs.ruby-lang.org/issues/15521
* Author: sue445 (Go Sueyoshi)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.0p0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
# Sample code
~~~ ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end
p str
p str.encoding
~~~
# Expected (on Ruby 2.5.3)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\nあ,い,う,え,お\n"
#<Encoding:UTF-8>
~~~
# Actual (on Ruby 2.6.0)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\n\xE3\x81\x82,\xE3\x81\x84,\xE3\x81\x86,\xE3\x81\x88,\xE3\x81\x8A\n"
#<Encoding:ASCII-8BIT>
~~~
This behavior is same to ruby-trunk
~~~
$ ruby -v
ruby 2.7.0dev (2019-01-10 trunk 66768) [x86_64-darwin17]
~~~
# Workaround
Use `force_encoding`
~~~ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end.force_encoding("UTf-8")
p str
p str.encoding
~~~
This works, but little dirty...
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-dev:50756] [Ruby trunk Bug#15521][Closed] encoding is missed when using `CSV.generate`
[not found] <redmine.issue-15521.20190110062059@ruby-lang.org>
2019-01-10 6:21 ` [ruby-dev:50755] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate` sue445fukuoka
@ 2019-01-10 6:34 ` kou
2019-01-10 6:57 ` [ruby-dev:50757] [Ruby trunk Bug#15521] " sue445fukuoka
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: kou @ 2019-01-10 6:34 UTC (permalink / raw)
To: ruby-dev
Issue #15521 has been updated by kou (Kouhei Sutou).
Status changed from Open to Closed
Assignee set to kou (Kouhei Sutou)
Thanks for your report.
This has been fixed at master: https://github.com/ruby/csv/issues/62
I'll release a new version in a few weeks. Could you try the release (or master) again?
----------------------------------------
Bug #15521: encoding is missed when using `CSV.generate`
https://bugs.ruby-lang.org/issues/15521#change-76180
* Author: sue445 (Go Sueyoshi)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v: ruby 2.6.0p0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
# Sample code
~~~ ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end
p str
p str.encoding
~~~
# Expected (on Ruby 2.5.3)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\nあ,い,う,え,お\n"
#<Encoding:UTF-8>
~~~
# Actual (on Ruby 2.6.0)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\n\xE3\x81\x82,\xE3\x81\x84,\xE3\x81\x86,\xE3\x81\x88,\xE3\x81\x8A\n"
#<Encoding:ASCII-8BIT>
~~~
This behavior is same to ruby-trunk
~~~
$ ruby -v
ruby 2.7.0dev (2019-01-10 trunk 66768) [x86_64-darwin17]
~~~
# Workaround
Use `force_encoding`
~~~ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end.force_encoding("UTf-8")
p str
p str.encoding
~~~
This works, but little dirty...
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-dev:50757] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate`
[not found] <redmine.issue-15521.20190110062059@ruby-lang.org>
2019-01-10 6:21 ` [ruby-dev:50755] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate` sue445fukuoka
2019-01-10 6:34 ` [ruby-dev:50756] [Ruby trunk Bug#15521][Closed] " kou
@ 2019-01-10 6:57 ` sue445fukuoka
2019-01-25 6:52 ` [ruby-dev:50770] " kou
2019-01-26 8:02 ` [ruby-dev:50773] " naruse
4 siblings, 0 replies; 5+ messages in thread
From: sue445fukuoka @ 2019-01-10 6:57 UTC (permalink / raw)
To: ruby-dev
Issue #15521 has been updated by sue445 (Go Sueyoshi).
Thank you.
I used `ruby/csv@master`, I confirmed this is fixed
----------------------------------------
Bug #15521: encoding is missed when using `CSV.generate`
https://bugs.ruby-lang.org/issues/15521#change-76181
* Author: sue445 (Go Sueyoshi)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v: ruby 2.6.0p0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
# Sample code
~~~ ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end
p str
p str.encoding
~~~
# Expected (on Ruby 2.5.3)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\nあ,い,う,え,お\n"
#<Encoding:UTF-8>
~~~
# Actual (on Ruby 2.6.0)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\n\xE3\x81\x82,\xE3\x81\x84,\xE3\x81\x86,\xE3\x81\x88,\xE3\x81\x8A\n"
#<Encoding:ASCII-8BIT>
~~~
This behavior is same to ruby-trunk
~~~
$ ruby -v
ruby 2.7.0dev (2019-01-10 trunk 66768) [x86_64-darwin17]
~~~
# Workaround
Use `force_encoding`
~~~ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end.force_encoding("UTf-8")
p str
p str.encoding
~~~
This works, but little dirty...
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-dev:50770] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate`
[not found] <redmine.issue-15521.20190110062059@ruby-lang.org>
` (2 preceding siblings ...)
2019-01-10 6:57 ` [ruby-dev:50757] [Ruby trunk Bug#15521] " sue445fukuoka
@ 2019-01-25 6:52 ` kou
2019-01-26 8:02 ` [ruby-dev:50773] " naruse
4 siblings, 0 replies; 5+ messages in thread
From: kou @ 2019-01-25 6:52 UTC (permalink / raw)
To: ruby-dev
Issue #15521 has been updated by kou (Kouhei Sutou).
I've updated `lib/csv` in r66922.
@naruse Could you backport the revision?
----------------------------------------
Bug #15521: encoding is missed when using `CSV.generate`
https://bugs.ruby-lang.org/issues/15521#change-76503
* Author: sue445 (Go Sueyoshi)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v: ruby 2.6.0p0
* Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED
----------------------------------------
# Sample code
~~~ ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end
p str
p str.encoding
~~~
# Expected (on Ruby 2.5.3)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\nあ,い,う,え,お\n"
#<Encoding:UTF-8>
~~~
# Actual (on Ruby 2.6.0)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\n\xE3\x81\x82,\xE3\x81\x84,\xE3\x81\x86,\xE3\x81\x88,\xE3\x81\x8A\n"
#<Encoding:ASCII-8BIT>
~~~
This behavior is same to ruby-trunk
~~~
$ ruby -v
ruby 2.7.0dev (2019-01-10 trunk 66768) [x86_64-darwin17]
~~~
# Workaround
Use `force_encoding`
~~~ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end.force_encoding("UTf-8")
p str
p str.encoding
~~~
This works, but little dirty...
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-dev:50773] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate`
[not found] <redmine.issue-15521.20190110062059@ruby-lang.org>
` (3 preceding siblings ...)
2019-01-25 6:52 ` [ruby-dev:50770] " kou
@ 2019-01-26 8:02 ` naruse
4 siblings, 0 replies; 5+ messages in thread
From: naruse @ 2019-01-26 8:02 UTC (permalink / raw)
To: ruby-dev
Issue #15521 has been updated by naruse (Yui NARUSE).
Backport changed from 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE
ruby_2_6 r66926 merged revision(s) 66922.
----------------------------------------
Bug #15521: encoding is missed when using `CSV.generate`
https://bugs.ruby-lang.org/issues/15521#change-76520
* Author: sue445 (Go Sueyoshi)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v: ruby 2.6.0p0
* Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE
----------------------------------------
# Sample code
~~~ ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end
p str
p str.encoding
~~~
# Expected (on Ruby 2.5.3)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\nあ,い,う,え,お\n"
#<Encoding:UTF-8>
~~~
# Actual (on Ruby 2.6.0)
~~~
$ ruby csv_generate.rb
"a,b,c,d,e\n\xE3\x81\x82,\xE3\x81\x84,\xE3\x81\x86,\xE3\x81\x88,\xE3\x81\x8A\n"
#<Encoding:ASCII-8BIT>
~~~
This behavior is same to ruby-trunk
~~~
$ ruby -v
ruby 2.7.0dev (2019-01-10 trunk 66768) [x86_64-darwin17]
~~~
# Workaround
Use `force_encoding`
~~~ruby
require "csv"
rows = [
["a", "b", "c", "d", "e"],
["あ", "い", "う", "え", "お"],
]
str = CSV.generate do |csv|
rows.each do |row|
csv << row
end
end.force_encoding("UTf-8")
p str
p str.encoding
~~~
This works, but little dirty...
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-26 8:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-15521.20190110062059@ruby-lang.org>
2019-01-10 6:21 ` [ruby-dev:50755] [Ruby trunk Bug#15521] encoding is missed when using `CSV.generate` sue445fukuoka
2019-01-10 6:34 ` [ruby-dev:50756] [Ruby trunk Bug#15521][Closed] " kou
2019-01-10 6:57 ` [ruby-dev:50757] [Ruby trunk Bug#15521] " sue445fukuoka
2019-01-25 6:52 ` [ruby-dev:50770] " kou
2019-01-26 8:02 ` [ruby-dev:50773] " naruse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).