Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Node#write_to and friends should accept Encoding objects for :encoding kwargs #2774

Closed
flavorjones opened this issue Jan 21, 2023 · 0 comments · Fixed by #2798
Closed

Comments

@flavorjones
Copy link
Member

flavorjones commented Jan 21, 2023

Currently these methods accept an :encoding arg, whose value is the name of the encoding:

node.write_to(io, encoding: "UTF-8")

When passing in an Encoding object, though, we get an error:

node.write_to(io, encoding: Encoding::UTF_8)
# TypeError: no implicit conversion of Encoding into String
#    .../lib/nokogiri/xml/node.rb:1368:in `native_write_to'
#    .../lib/nokogiri/xml/node.rb:1368:in `write_to'

We should handle Encoding objects wherever we accept encoding name strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant