[ 
https://issues.apache.org/jira/browse/MRESOURCES-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15076393#comment-15076393
 ] 

Karl Heinz Marbaise commented on MRESOURCES-171:
------------------------------------------------

Based on the documentation UTF-8 encoding it *NOT* illegal nor any other 
encoding, cause if this would be true no one from other countries like Finland, 
Norway, Sweden, Japan, China, Russia,  just to mention a few etc. could ever 
correctly define text messages in property files (cause those text won't work 
with ISO-8859-1)...Based on the references you gave and quoted you should quote 
the whole sentences:

{quote}
The load(InputStream) / store(OutputStream, String) methods work the same way 
as the load(Reader)/store(Writer, String) pair, except the input/output stream 
is encoded in ISO 8859-1 character encoding. Characters that cannot be directly 
represented in this encoding can be written using Unicode escapes as defined in 
section 3.3 of The Java™ Language Specification; only a single 'u' character is 
allowed in an escape sequence. The native2ascii tool can be used to convert 
property files to and from other character encodings.
{quote}
Furthermore if you take a deeper look into methods like 
[load(InputStream):|http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.InputStream)]
{quote}
Reads a property list (key and element pairs) from the input byte stream. The 
input stream is in a simple line-oriented format as specified in load(Reader) 
and is assumed to use the ISO 8859-1 character encoding; that is each byte is 
one Latin1 character. Characters not in Latin1, and certain special characters, 
are represented in keys and elements using Unicode escapes as defined in 
section 3.3 of The Java™ Language Specification.
{quote}
Which is also talking about: {quote}and is assumed to use the ISO 8859-1 
character encoding{quote} which does not mean they have to be encoded in 
ISO-8859-1...only they can...


This means here. A property file is read by ISO8859-1 character encoding *if* 
nothing else is defined which means nothing like {{-Dfile.encoding=...}} has 
been defined for the JVM. Furthermore i have given an example how to copy 
resources which are encoded in different encoding than the rest of your source 
files which has been defined by  
{{<project.build.sourceEncoding>WhatEverYouUse</project.build.sourceEncoding>}}.
 

> ISO8859-1 properties files get changed into UTF-8 when filtered
> ---------------------------------------------------------------
>
>                 Key: MRESOURCES-171
>                 URL: https://issues.apache.org/jira/browse/MRESOURCES-171
>             Project: Maven Resources Plugin
>          Issue Type: Bug
>          Components: filtering
>            Reporter: Alex Collins
>            Priority: Minor
>         Attachments: filtering-bug.zip
>
>
> Create:
> src/main/resources/test.properties
> And add a ISO8859-1 character that is not ASCII or UTF-8, do not use \uXXXX 
> formatting.
> When adding this line:
> <resource><directory>src/main/resources</directory><filtering>true</filtering></resource>
> Expected:
> ISO8859-1 encoded file in jar.
> Actual:
> UTF-8 encoded file in jar.
> ---
> If there are any property files (which can only be ISO8859-1) they appear to 
> be converted into UTF-8 in the jar.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to