Project

General

Profile

Actions

Bug #19235

closed

StringIO.new(encoding: "ext_enc:int_enc") doesn't set external encoding

Added by andrykonchin (Andrew Konchin) over 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:111287]

Description

I noticed a divergence between IO :encoding option documentation and StringIO's behaviour:

io = StringIO.new('', 'w', encoding: 'utf-8:ISO-8859-1')
io.external_encoding # => #<Encoding:ISO-8859-1>

According to the documentation:

:encoding: Specifies external and internal encodings as 'extern:intern'.

The IO class behaves in expected way:

f = File.open("test.txt", 'w', encoding: 'UTF-8:ISO-8859-1')
f.external_encoding # => #<Encoding:UTF-8>

Related issues 1 (1 open0 closed)

Related to Ruby master - Bug #16497: StringIO#internal_encoding is broken (more severely in 2.7)Assignednobu (Nobuyoshi Nakada)Actions
Actions #1

Updated by zverok (Victor Shepelev) over 1 year ago

  • Related to Bug #16497: StringIO#internal_encoding is broken (more severely in 2.7) added

Updated by zverok (Victor Shepelev) over 1 year ago

The StringIO doesn't have a proper concept of two encodings implemented :(
Also reported here #16497 but still not fixed completely.

I'll try to look into it this weekend.

Updated by zverok (Victor Shepelev) over 1 year ago

Though it is kinda specified in README :)))

encoding conversion is not implemented, and ignored silently.

Actions #4

Updated by andrykonchin (Andrew Konchin) over 1 year ago

  • Description updated (diff)

Updated by andrykonchin (Andrew Konchin) about 1 year ago

Yeah, so this issue is a duplicate. My bad (.

So this issue probably should be closed. I don't have permissions to close it myself. Could anybody close it?

Actions #6

Updated by jeremyevans0 (Jeremy Evans) about 1 year ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0