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

Encoding::InvalidByteSequenceError in C locale (probably any non UTF8 locale) #27

Open
pravi opened this issue Jun 8, 2013 · 0 comments

Comments

@pravi
Copy link

pravi commented Jun 8, 2013

While packaging http_parser.rb, ruby 1.9.1 tests are failing with

/usr/lib/ruby/vendor_ruby/json/common.rb:155:in `encode': "\xC3" on
US-ASCII (Encoding::InvalidByteSequenceError)

in pbuilder (a clean package building tool which defaults to LANG=C). Looking on the web I found
http://stackoverflow.com/questions/12130162/cucumber-fails-with-json-encodinginvalidbytesequenceerror

I have LANG=ml_IN as my default locale and dpkg-buildpackage works
(which uses my system locale). Also ruby 1.8 does not have this
problem.

an interesting discussion I found on this topic
http://www.ruby-forum.com/topic/136955

I think it is a bug in json library to depend on system locale. Any
ideas how to fix this?

I was thinking of setting up a UTF8 locale in pbuilder, but that
doesn't seem like the right approach.

You can run LANG=C rspec to reproduce this error.

$ LANG=C rspec
/usr/lib/ruby/vendor_ruby/json/common.rb:155:in `encode': "\xC3" on US-ASCII (Encoding::InvalidByteSequenceError)
        from /usr/lib/ruby/vendor_ruby/json/common.rb:155:in `initialize'
        from /usr/lib/ruby/vendor_ruby/json/common.rb:155:in `new'
        from /usr/lib/ruby/vendor_ruby/json/common.rb:155:in `parse'
        from /media/pravi/forge/debian/git/pkg-ruby-extras/ruby-http-parser.rb/spec/parser_spec.rb:286:in `block (2 levels) in <top (required)>'
        from /media/pravi/forge/debian/git/pkg-ruby-extras/ruby-http-parser.rb/spec/parser_spec.rb:285:in `each'
        from /media/pravi/forge/debian/git/pkg-ruby-extras/ruby-http-parser.rb/spec/parser_spec.rb:285:in `block in <top (required)>'
        from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:242:in `module_eval'
        from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:242:in `subclass'
        from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:228:in `describe'
        from /usr/lib/ruby/vendor_ruby/rspec/core/dsl.rb:18:in `describe'
        from /media/pravi/forge/debian/git/pkg-ruby-extras/ruby-http-parser.rb/spec/parser_spec.rb:4:in `<top (required)>'
        from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:819:in `load'
        from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:819:in `block in load_spec_files'
        from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:819:in `each'
        from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:819:in `load_spec_files'
        from /usr/lib/ruby/vendor_ruby/rspec/core/command_line.rb:22:in `run'
        from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:80:in `run'
        from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:17:in `block in autorun'
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

1 participant