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

Alexandre Cartapanis commented on FELIX-4416:
---------------------------------------------

Quotation from your link: 
"The load(Reader) / store(Writer, String) methods load and store properties 
from and to a character based stream in a simple line-oriented format specified 
below. 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.
The loadFromXML(InputStream) and storeToXML(OutputStream, String, String) 
methods load and store properties in a simple XML format. By default the UTF-8 
character encoding is used, however a specific encoding may be specified if 
required. An XML properties document has the following DOCTYPE declaration:"

For me i understand as this:
Loading properties from a Reader can be done for any encoding
Loading properties from an InputStream always use ISO 8859-1
Loading properties from an XML file should be possible, and in this case UTF-8 
is the default encoding.

Why do you use the "load(InputStream ...)" method and not the "load(Reader 
...)" method ? This would resolve the problem for me.

> CFG file encoding
> -----------------
>
>                 Key: FELIX-4416
>                 URL: https://issues.apache.org/jira/browse/FELIX-4416
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions: fileinstall-3.2.6
>         Environment: Karaf 2.3.3
>            Reporter: Alexandre Cartapanis
>
> FileInstall always use ISO-8859-1 for reading cfg file, even if the CFG file 
> is not encoded in ISO-8859-1.
> So when the CFG file contains non-ascii characters, those characters are 
> "transformed" during parsing. Typically my file contains the line 
> "error.message.210=Identifiant d'entité cible invalide" (without the "") but 
> after FileInstall parsing, my string is transformed into "Identifiant 
> d'entité cible invalide" (still without the "").
> The org.apache.felix.utils.properties.Properties class has a default encoding 
> defined to ISO-8859-1,which is always used whatever the actual file encoding 
> is.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to