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

Wrong encoding for to_blob return string #94

Closed
tweksteen opened this issue Jul 20, 2015 · 2 comments
Closed

Wrong encoding for to_blob return string #94

tweksteen opened this issue Jul 20, 2015 · 2 comments

Comments

@tweksteen
Copy link
Contributor

By default, StringIO will use the external string encoding. In most cases, 'UTF-8' will be used. This creates an issue when using StringIO to generate a blob. (By definition, a blob should use 'ASCII-8BIT'):
https://github.com/wvanbergen/chunky_png/blob/dc526b4a/lib/chunky_png/datastream.rb#L177

This could easily be fixed by adding str.set_encoding('ASCII-8BIT') after the string creation.

See point 5 of http://blog.rayapps.com/2013/03/11/7-things-that-can-go-wrong-with-ruby-19-string-encodings/ for further details.

@wvanbergen
Copy link
Owner

Fixed by #95.

@wvanbergen
Copy link
Owner

This may have introduced #105

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