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 failure with non-ASCII characters for git_info (author name, ...) #24

Open
IchordeDionysos opened this issue May 7, 2021 · 1 comment

Comments

@IchordeDionysos
Copy link
Contributor

Got this well known encoding issue (#2, #13), but this time not for the sources files, but for the git_info :D

One author name on our team has a German special character in his name ü, which is fairly common in Germany.

So we get this error for all his PRs :)

/usr/local/lib/ruby/gems/2.5.0/gems/coveralls-lcov-1.6.0/lib/coveralls/lcov/runner.rb:106:in `encode': "\xC3" on US-ASCII (Encoding::InvalidByteSequenceError)
	from /usr/local/lib/ruby/gems/2.5.0/gems/coveralls-lcov-1.6.0/lib/coveralls/lcov/runner.rb:106:in `to_json'
	from /usr/local/lib/ruby/gems/2.5.0/gems/coveralls-lcov-1.6.0/lib/coveralls/lcov/runner.rb:106:in `run'
	from /usr/local/lib/ruby/gems/2.5.0/gems/coveralls-lcov-1.6.0/bin/coveralls-lcov:5:in `<top (required)>'
	from /usr/local/bin/coveralls-lcov:23:in `load'
	from /usr/local/bin/coveralls-lcov:23:in `<main>'

From looking at the PR changes, branch name, and git log I am fairly certain, that in our case it's related to these lines:
https://github.com/okkez/coveralls-lcov/blob/master/lib/coveralls/lcov/converter.rb#L22
https://github.com/okkez/coveralls-lcov/blob/master/lib/coveralls/lcov/converter.rb#L97

But those lines might also become a potential problem:
https://github.com/okkez/coveralls-lcov/blob/master/lib/coveralls/lcov/converter.rb#L94
https://github.com/okkez/coveralls-lcov/blob/master/lib/coveralls/lcov/converter.rb#L96
https://github.com/okkez/coveralls-lcov/blob/master/lib/coveralls/lcov/converter.rb#L98
https://github.com/okkez/coveralls-lcov/blob/master/lib/coveralls/lcov/converter.rb#L101

I am not very familiar with Ruby, but it looks like such a solution might help here:
https://stackoverflow.com/questions/263271/converting-utf8-to-ansi-with-ruby

@okkez
Copy link
Owner

okkez commented Feb 5, 2022

Sorry for being late.
I could not represent the issue on my local environment.

Please run following script to show me your environment:

p RUBY_VERSION
p Encoding.default_external
p Encoding.default_internal
p ENV["LANG"]
author_name = `git log -1 --format=%aN`
p author_name
p author_name.encoding
p author_name.codepoints

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