mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
106 stars 77 forks source link

generator xsd charset issue #117

Closed anole1982 closed 5 years ago

anole1982 commented 6 years ago

when i want xsd file as UTF-8 charset, encoding not be effact。 class XsdGeneratorHelper method savePrettyPrintedDocument

out = new BufferedWriter(new FileWriter(targetFile)); to out = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (targetFile),"UTF-8"));

lennartj commented 5 years ago

It should make sense to use the same encoding as the J-M-P uses in other cases. Hence, the encoding within the OutputStreamWriter statement should be

 new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile), charsetName));

where the charsetName would use the property set by

    @Parameter(defaultValue = "${project.build.sourceEncoding}")
    private String encoding;