TL;DR
Set the environment variable JAVA_TOOL_OPTIONS
to -Dfile.encoding = UTF-8
.
If you have defined a custom message etc. in GARMIN FIT SDK, you need to execute FitGen.exe to generate FIT SDK. https://developer.garmin.com/fit/cookbook/fitgen/
However, the document comment of EventMesg.java of FIT SDK recently distributed by Garmin Developers contains a mysterious garbled character, and when FitGen.exe is executed as it is
> .\FitGen.exe -o test -java
FIT Code Generator - Protocol 2.00 Profile 21.40Release
SDK Version: production/akw/21.40.00-0-g813c158
Parsing existing config.csv...
Writing new config.csv...
Generating Java code...
Building Java tools...0%
com\garmin\fit\EventMesg.java:679:error:This character cannot be mapped to encoding MS932
* Comment:The Tetsu?first tetsu?byte?is tetsu?the tetsu?radar_threat_level_max, the tetsu?second tetsu?byte?is tetsu?the tetsu?radar_threat_count, and the tetsu?last tetsu?16?bits?are tetsu?reserved?for Tetsu?future?use?and tetsu?should?be tetsu?set?to Tetsu?FFFF.
^
The following is omitted
Error occurs and the build fails.
The error This character cannot be mapped to encoding MS932
can be avoided by passing an appropriate encoding such as UTF-8 to javac. This can be avoided by passing the following options.
javac -encoding UTF-8 EventMesg.java
However, in the case of FitGen.exe, the javac call part is done inside FitGen.exe, so you cannot pass options directly to javac.
Therefore, you can avoid the error by adding JAVA_TOOL_OPTIONS to the user environment variable of Windows that executes FitGen.exe and specifying the option you want to pass to javac.
https://docs.oracle.com/javase/jp/8/docs/technotes/guides/troubleshoot/envvars002.html https://qiita.com/n_slender/items/6c566bb345e844ba8127
Recommended Posts