Posted by
maxmil on
Apr 04, 2014; 6:04am
URL: https://discuss.asciidoctor.org/Force-encoding-when-using-the-asciidoctor-maven-plugin-on-windows-tp1669.html
Using the asciidoctor-maven-plugin on Windows we are getting an encoding incompatability error when ejecuting the goal process-asciidocs.
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:1.5.0-SNAPSHOT:process-asciidoc (default-cli) on project lgtdev-doc: Execution default-cli of goal org.asciido
ctor:asciidoctor-maven-plugin:1.5.0-SNAPSHOT:process-asciidoc failed: (Encoding::CompatibilityError) incompatible character encodings: CP850 and UTF-8
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.asciidoctor:asciidoctor-maven-plugin:1.5.0-SNAPSHOT:process-asciidoc failed: (Encoding::CompatibilityError) incompatible character encodings: CP850 and UTF-8
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.jruby.exceptions.RaiseException: (Encoding::CompatibilityError) incompatible character encodings: CP850 and UTF-8
at org.jruby.RubyString.concat(org/jruby/RubyString.java:2636)
at RUBY.result((erb):58)
at org.jruby.RubyKernel.eval(org/jruby/RubyKernel.java:1093)
at RUBY.result(jar:file:/C:/Users/AUX7010/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/erb.rb:838)
at RUBY.render(jar:file:C:/Users/AUX7010/.m2/repository/org/asciidoctor/asciidoctor-java-integration/0.1.4/asciidoctor-java-integration-0.1.4.jar!/gems/asciidoctor-0.1.4/lib/asciidoctor/backends/base_template.rb:55)
at RUBY.render(jar:file:C:/Users/AUX7010/.m2/repository/org/asciidoctor/asciidoctor-java-integration/0.1.4/asciidoctor-java-integration-0.1.4.jar!/gems/asciidoctor-0.1.4/lib/asciidoctor/renderer.rb:137)
at RUBY.render(jar:file:C:/Users/AUX7010/.m2/repository/org/asciidoctor/asciidoctor-java-integration/0.1.4/asciidoctor-java-integration-0.1.4.jar!/gems/asciidoctor-0.1.4/lib/asciidoctor/document.rb:769)
at RUBY.render(jar:file:C:/Users/AUX7010/.m2/repository/org/asciidoctor/asciidoctor-java-integration/0.1.4/asciidoctor-java-integration-0.1.4.jar!/gems/asciidoctor-0.1.4/lib/asciidoctor.rb:915)
at RUBY.render_file(jar:file:C:/Users/AUX7010/.m2/repository/org/asciidoctor/asciidoctor-java-integration/0.1.4/asciidoctor-java-integration-0.1.4.jar!/gems/asciidoctor-0.1.4/lib/asciidoctor.rb:993)
at RUBY.render_file(<script>:51)
at org.jruby.gen.InterfaceImpl1306937631.render_file(org/jruby/gen/InterfaceImpl1306937631.gen:13)
When using the CRuby with the asciidoctor gem we don't get this error so i imagine that the problem is with the JRuby execution environment.
On Mac we solved the same error by setting JAVA_TOOL_OPTIONS="-DFile=encoding.UTF-8" but on Windows this has no effect.
How can we coerce JRuby into using UTF-8?
Note: We have tried with the 0.1.4 release of the plugin and the latest SNAPSHOT from master.
Note: This is a duplicate of
http://stackoverflow.com/questions/22831615/force-encoding-in-jruby-when-using-the-asciidoctor-maven-plugin-on-windows which i posted yesterday but hasn't received much interest. Feel free to post there and here if you want more reputation.