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

"ArgumentError: invalid byte sequence in US-ASCII" when parsing the public suffix list #98

Closed
dentarg opened this issue Sep 19, 2016 · 2 comments
Labels

Comments

@dentarg
Copy link
Collaborator

dentarg commented Sep 19, 2016

Seen in an application not using LANG=en_US.UTF-8:

ArgumentError: invalid byte sequence in US-ASCII
  from public_suffix/list.rb:89:in `strip!'
  from public_suffix/list.rb:89:in `block (2 levels) in parse'
  from public_suffix/list.rb:88:in `each_line'
  from public_suffix/list.rb:88:in `block in parse'
  from public_suffix/list.rb:128:in `initialize'
  from public_suffix/list.rb:87:in `new'
  from public_suffix/list.rb:87:in `parse'
  from twingly/public_suffix_list.rb:12:in `with_punycoded_names'
  from twingly/url.rb:15:in `<class:URL>'
  from twingly/url.rb:11:in `<module:Twingly>'
  from twingly/url.rb:10:in `<top (required)>'
  from twingly/url/hasher.rb:3:in `require_relative'
  from twingly/url/hasher.rb:3:in `<top (required)>'
  from /home/deploy/twingly-wally/releases/20160916113112/lib/models/...

Fortunately, we read the list ourselves, so we can read it with the correct encoding.

(public_suffix just trusts the default encoding: https://github.com/weppos/publicsuffix-ruby/blob/v2.0.2/lib/public_suffix/list.rb#L52)

@dentarg
Copy link
Collaborator Author

dentarg commented Sep 19, 2016

@dentarg
Copy link
Collaborator Author

dentarg commented Sep 19, 2016

(public_suffix just trusts the default encoding: https://github.com/weppos/publicsuffix-ruby/blob/v2.0.2/lib/public_suffix/list.rb#L52)

Suggested to public_suffix that they always use UTF-8: weppos/publicsuffix-ruby#118

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

No branches or pull requests

1 participant