2

I have a requirement to build an eclipse project via ant script that also requires my date/location and system locale to Greek. So, I've come across the error below

"unmappable character for encoding UTF-8
    [javac] // Generated on: 2018.09.08 at 12:10:19 ?? CST"

This is the exact comment lines from the generated Java class.

// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.5-b01-fcs

// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>

// Any modifications to this file will be lost upon recompilation of the source schema.

// Generated on: 2018.09.08 at 12:10:19 πμ CST

With my research from the past few days, I learned that the timestamp has a prepared format that it sets for its value. So modifying my system date/time format wouldn't work.

All encoding are set to "UTF-8". Is there a command/property available for use to ignore this specific character during compile? Because apparently, I'm thinking of a script to be ran to modify the classes and have the comments removed(after generated) so during compile I wouldn't get any errors.

Dherik
  • 17,757
  • 11
  • 115
  • 164
  • Since the `xjc` command doesn't have an option to specify the file encoding, and you want your source files to be UTF-8 encoded, you'll need to run a re-encoding program after generating the source files, to change encoding from Greek (ISO-8859-7?) to UTF-8. – Andreas Sep 07 '18 at 18:11
  • See also: [JAXB XJC Possible to suppress comment creation in generated classes?](https://stackoverflow.com/q/5093514/5221149) – Andreas Sep 07 '18 at 18:11

2 Answers2

0

Please see my answer how to customize file header and remove date: JAXB XJC Possible to suppress comment creation in generated classes? that should resolve your problem.

Also you may just provide correct locale. See related answer how to make cxf-xjc-plugin generate sources in utf-8

Hubbitus
  • 5,161
  • 3
  • 41
  • 47
0

Refer to the documentation here. Use -no-header and the comment generation will be suppressed completely.