Open olib963 opened 4 years ago
After a brief look setting jvm_flags = ["-Dfile.encoding=UTF-8"]
on the java binary seems to fix this. I have just redeclared this binary in my own project by adding the CLI to my maven dependencies and creating a new target.
If you feel this is a suitable work around please close the issue :D Personally I think it would be nice if this could be configured.
Hey @olib963, thanks for looking into this!
I think having this be configurable is a good idea. A simple select
on the compiler-cli
binary would probably do the trick. This could set jvm_flags = ["-Dfile.encoding=UTF-8"]
if --action_env JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
is specified but default to the current behavior otherwise. Would you be interested in opening a PR?
Thanks for the quick response :D I would be happy to look into a PR sometime next week. I am a little new to bazel so will try my best to get something up and running.
Would you prefer the approach that we
--action_env
Using --action_env
probably makes the most sense here :)
That really is the expected behavior, but we decoupled the twirl templates compiler cli from the rule set (i.e. it's pre-built now) which means Bazel command args don't affect it.
Thanks for the work on creating a bazel wrapper for twirl!
It seems the default encoding used by bazel is US-ASCII, we are moving from SBT to bazel and the sbt plugin uses a default of UTF-8. This change is causing any UTF-8 special characters to be written as "??" in our compiled templates.
I have managed to get the default character set in the JVM to be UTF-8 by setting:
in
.bazelrc
but this does not seem to be passed on to the twirl compiler.I was wondering if you had a suggested approach to solving this. I can do a little dive into the code and try to get it running locally but I thought I would check if you already had something in mind for this.