Skip to content

ArgumentError: unknown encoding name - iso-8859-1|utf-8 #254

@rstueven

Description

@rstueven

Ruby 2.7.6 / Rails 6.0.5

This line worked without error in Ruby 2.4.6:
csv_rows = CSV.parse(file_contents, headers: true, encoding: 'iso-8859-1|utf-8')

It fails with this error in Ruby 2.7.6:
ArgumentError: unknown encoding name - iso-8859-1|utf-8

I have also tried ISO-8859-1|UTF-8, iso-8859-1:utf-8, and ISO-8859-1:UTF-8, and they give the same error.

Both encodings exist, but it doesn't find the combination:

[3] pry(main)> Encoding.find("iso-8859-1|utf-8")
ArgumentError: unknown encoding name - iso-8859-1|utf-8
from (pry):3:in `find'
[4] pry(main)> Encoding.find("iso-8859-1")
=> #<Encoding:ISO-8859-1>
[5] pry(main)> Encoding.find("utf-8")
=> #<Encoding:UTF-8>
[6] pry(main)> Encoding.find("iso-8859-1:utf-8")
ArgumentError: unknown encoding name - iso-8859-1:utf-8
from (pry):7:in `find'

This was supposedly fixed in Issue #23 , but I'm still getting the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions