Skip to content

String#encode hard errors without replacement for ASCII 8-bit range to multibyte #461

@headius

Description

@headius

This is the remaining failure in resque's 1-x-stable branch in 1.9 mode. The following code should work in 1.9 mode:

str = "\xFA\x8D\xA8\x8A\xBF4\xD3\x9FV]_"
str.force_encoding('BINARY').encode('UTF-8', :invalid => :replace, :undef => :replace)

We have a hard check for ASCII to multibyte that always raises error for 8-bit characters. In the case that :undef => :replace is specified, we should be allowing the encoding process to proceed to replacing those bytes, rather than hard erroring.

Fix pending.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions