-
Notifications
You must be signed in to change notification settings - Fork 55
Description
I'm seeing undefined conversion errors when trying to write out the result files when the source file contains extended ascii characters. The write_file method in lib/simplecov-rcov.rb:
https://github.com/fguillen/simplecov-rcov/blob/master/lib/simplecov-rcov.rb#L49
returns a string with ASCII-8BIT encoding, and as a result when trying to write the file out it fails with something like:
Encoding::UndefinedConversionError:
"\xE2" from ASCII-8BIT to UTF-8
In my case I have character \x2019 in the source file (an accented apostrophe) although this could of likely be any extended ascii character.
If I change the encoding of the result to match the template encoding:
rcov_result.encoding(template.encoding)
everything 'works', but this seems really heavy handed
The issue would appear to come from a change in behaviour for the ERB result function where in ruby < 2.5 it would return the template encoding but in 2.5 it's returning the injected line encoding
Another option would be to address this upstream within the simplecov project such that the file source would already be in the expected encoding?
Thoughts?