mikebowler / jirametrics

A tool to extract data from Jira and either generate reports or export to CSV files
Apache License 2.0
34 stars 1 forks source link

Encoding::CompatibilityError #27

Closed SimoneCusimano closed 3 months ago

SimoneCusimano commented 3 months ago

During the html report, I receive this error.

I can't figure out which PBI is causing the error. Would it be possible to increase the verbosity of the log? It would be helpful to at least have the id of the affected PBI.

Logs follow: `Encoding::CompatibilityError: incompatible encodings: IBM437 and UTF-8 ←[0;31m << at org/jruby/RubyString.java:2715←[0m result at (erb):25←[0m ←[0;36m eval at org/jruby/RubyKernel.java:1265←[0m result at [...]/jruby-9.4.6.0/lib/ruby/stdlib/erb.rb:905←[0m render at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/chart_base.rb:38←[0m wrap_and_render at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/chart_base.rb:52←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/data_quality_report.rb:59←[0m execute_chart at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/html_report_config.rb:191←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/html_report_config.rb:39←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/file_config.rb:27←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/project_config.rb:47←[0m ←[0;36m each at org/jruby/RubyArray.java:1983←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/project_config.rb:46←[0m export at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/exporter.rb:45←[0m each_project_config at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/exporter.rb:73←[0m ←[0;36m each at org/jruby/RubyArray.java:1983←[0m each_project_config at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/exporter.rb:72←[0m export at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics/exporter.rb:43←[0m go at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/lib/jirametrics.rb:30←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor/command.rb:27←[0m invoke_command at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor/invocation.rb:127←[0m dispatch at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor.rb:392←[0m start at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor/base.rb:485←[0m

at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.2.1/bin/jirametrics:5←[0m ←[0;36m load at org/jruby/RubyKernel.java:1211←[0m
at [...]/jruby-9.4.6.0/bin/jirametrics:25←[0m`
mikebowler commented 3 months ago

Based on what I'm seeing, I'd guess it's an ERB file that was loaded with the wrong encoding, not the issue. Specifically this one -> lib/jirametrics/html/data_quality_report.erb

I would have expected every file to be loaded as UTF-8 so this is puzzling

mikebowler commented 3 months ago

What if you set the default encoding for the JVM like this? I'm not able to reproduce the problem so this is purely a guess on my part, but it seems reasonable that if we can tell the JVM to use UTF-8 as the default encoding, it may fix the problem.

jruby -J-Dfile.encoding=UTF-8 -S jirametrics export

mikebowler commented 3 months ago

I've pushed a prerelease of 2.3, which explicitly forces all files to UTF-8. You can install with gem install jirametrics --pre. Note that the --pre is required for you to be able to install it. Let me know if this fixes this particular problem.

SimoneCusimano commented 3 months ago

I just tried it and you are right! The prerelease fixes the problem. Thanks Mike ;-)

mikebowler commented 3 months ago

2.3 final has been published, with this fix.