Project

General

Profile

Actions

Bug #9314

closed

String#encode method raises TypeError when called with Encoding::UTF_16

Added by krists.ozols (Krists Ozols) over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:59354]

Description

It works with encodings like Encoding::UTF_8..

"test_string".encode(Encoding::UTF_8) # works
"test_string".encode(Encoding::UTF_8.to_s) # works
"test_string".encode(Encoding::UTF_16) # does not work. Error: `encode': no implicit conversion of Encoding into String (TypeError) from ...
"test_string".encode(Encoding::UTF_16.to_s) # works

it did not raise any errors in previous ruby versions.

Actions

Also available in: Atom PDF