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

IOExtras::AbstractOutputStream doesn't implement external_encoding #546

Open
dmolesUC opened this issue Jan 19, 2023 · 2 comments
Open

IOExtras::AbstractOutputStream doesn't implement external_encoding #546

dmolesUC opened this issue Jan 19, 2023 · 2 comments

Comments

@dmolesUC
Copy link

With nokogiri 1.14.0 and rubyzip 2.3.2, running the code below fails with NoMethodError: undefined method 'external_encoding' for #<Zip::OutputStream:0x00000001241ec308>:

doc = Nokogiri::XML("<test/>")
Zip::OutputStream.open('test.zip') do |out|
  out.put_next_entry('test.xml')
  doc.write_to(out, encoding: 'UTF-8')
end

I'm not sure why Nokogiri calls external_encoding as as from the IO and Encoding docs external_encoding appears to be only for reading, but it also seems from the docs like just returning nil would be a legit implementation.

(Cf. sparklemotion/nokogiri#2773)

@hainesr
Copy link
Member

hainesr commented Jan 29, 2023

Thanks for raising this. I've looked at the issue you link above and it looks like they have fixed things on their end, is that right?

@dmolesUC
Copy link
Author

It looks like it's fixed in the latest Nokogiri, or will be shortly. Still wouldn't hurt to add a nil implementation, but it's your call.

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

No branches or pull requests

2 participants