*
The moose likes Ant, Maven and Other Build Tools and the fly likes An UTF-8 Maven build with n ISO-8859-1 property files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "An UTF-8 Maven build with n ISO-8859-1 property files" Watch "An UTF-8 Maven build with n ISO-8859-1 property files" New topic
Author

An UTF-8 Maven build with n ISO-8859-1 property files

hoppe slott
Greenhorn

Joined: Mar 13, 2010
Posts: 2
Hi everyone!

I'm struggling with the following problem:
1) production server has the following system default encoding : UTF-8
2) We want to use UTF-8, every file is stored as UTF-8 etc
3) But because of struts and the Java Properties class, our language resource files are stored as ISO-8859-1.
4) When running the maven build somehow all the files stored as ISO-8859-1 gets converted to UTF-8 in the build output

Unwanted result: æøå becomes gibberish
Possible, but unwanted solution: replace all æøå with unicode escape characters \uxxxx

Is it at all possible to tell maven to do the following:
1) do your usual stuff
2) BUT leave the storage format of the following files alone!

Hope someone out there can help. Google couldn't this time :-/

Regards,
Hoppeslott
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Hoppe,

Have you tried playing with the encoding settings in your POM?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
hoppe slott
Greenhorn

Joined: Mar 13, 2010
Posts: 2
Solved it by using
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>native2ascii</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<src><oursource></src>
<dest>target/native2ascii_tmp</dest>
<includes>**/*.properties</includes>
</configuration>
</execution>
</executions>
</plugin>

and then running the files through the filter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: An UTF-8 Maven build with n ISO-8859-1 property files