<div dir="ltr">From the javadoc of java.util.ResourceBundle the encoding for .properties is still expected to be ISO-8859-1:<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(71,71,71);font-family:"DejaVu Serif",Georgia,"Times New Roman",Times,serif;font-size:14px;line-height:19.6px">Constructing a PropertyResourceBundle instance from an InputStream requires that the input stream be encoded in ISO-8859-1. In that case, characters that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes as defined in section 3.3 of </span><cite style="color:rgb(71,71,71);font-family:"DejaVu Serif",Georgia,"Times New Roman",Times,serif;font-size:14px;line-height:19.6px">The Java™ Language Specification</cite><span style="color:rgb(71,71,71);font-family:"DejaVu Serif",Georgia,"Times New Roman",Times,serif;font-size:14px;line-height:19.6px"> whereas the other constructor which takes a Reader does not have that limitation.</span><br></blockquote><div><br></div><div><div><a href="https://docs.oracle.com/javase/8/docs/api/java/util/PropertyResourceBundle.html">https://docs.oracle.com/javase/8/docs/api/java/util/PropertyResourceBundle.html</a></div><div><br></div><div>I understand that Spring allows one to read .properties using any encoding, but you need to specify the encoding in Spring configuration external to the .properties file.</div><div><br></div><div>In my opinion it would cause unnecessary confusion amongst developers to use any other encoding than the one defined by the official documentation for Properties.</div><div><br></div><div>Best regards,</div><div>Thomas </div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 6, 2016 at 12:40 PM, Hiroyuki Wada <span dir="ltr"><<a href="mailto:wadahiro@gmail.com" target="_blank">wadahiro@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I think it was true before Java 1.6 because Java standard library<br>
(java.util.ResourceBundle or java.util.Properties) only supported<br>
ISO-8859-1 encoding file.<br>
But they support any encoding after Java 1.6. There are some<br>
frameworks which can read .properties with any encoding. For example,<br>
Spring Framework can read .properties with any encoding. I think it's<br>
very useful to read UTF-8 directly for multibyte language country.<br>
<div class=""><div class="h5"><br>
On Wed, Jul 6, 2016 at 3:32 PM, Thomas Raehalme<br>
<<a href="mailto:thomas.raehalme@aitiofinland.com">thomas.raehalme@aitiofinland.com</a>> wrote:<br>
> Please correct me if I am wrong, but I have been under the impression that<br>
> Java .properties files should always use encoding ISO-8859-1. Characters not<br>
> present in ISO-8859-1 can be written in \uxxxx. Won't it make things<br>
> confusing to developers if another encoding is used here instead?<br>
><br>
> <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.InputStream-" rel="noreferrer" target="_blank">https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.InputStream-</a><br>
> <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#store-java.io.OutputStream-java.lang.String-" rel="noreferrer" target="_blank">https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#store-java.io.OutputStream-java.lang.String-</a><br>
><br>
> If alternate encodings are desired how about supporting the XML format of<br>
> Properties?<br>
><br>
> Best regards,<br>
> Thomas<br>
><br>
><br>
> On Wed, Jul 6, 2016 at 9:04 AM, Stian Thorgersen <<a href="mailto:sthorger@redhat.com">sthorger@redhat.com</a>><br>
> wrote:<br>
>><br>
>> Both iso-8859-1 and utf-8 message bundles should be able to co-exist.<br>
>><br>
>> We can allow specifying the encoding in a comment on the first line like<br>
>> this:<br>
>><br>
>> # encoding=utf-8<br>
>> key=value<br>
>><br>
>> # encoding=iso-8859-1<br>
>> key=value<br>
>><br>
>> If the first line in the file doesn't contain the comment with the<br>
>> encoding then we should default to iso-8859-1 for backwards compatibility<br>
>><br>
>> On 5 July 2016 at 09:49, Hiroyuki Wada <<a href="mailto:wadahiro@gmail.com">wadahiro@gmail.com</a>> wrote:<br>
>>><br>
>>> Thanks for your comment.<br>
>>><br>
>>> > If we want to change to utf-8 we'd still need to support iso.. for<br>
>>> > backwards compatibility.<br>
>>><br>
>>> If we change to UTF-8, we can still read unicode codepoint like '\u00e8'.<br>
>>> There is an incompatibility when non-ascii characters are used in<br>
>>> message properties.<br>
>>> The non-ascii characters are 0xA0 - 0xFF codes (please refer codepage<br>
>>> layout: <a href="https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Codepage_layout" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Codepage_layout</a> )<br>
>>><br>
>>> I think the non-ascii characters might be used in French messages like<br>
>>> 'à' so I agree to support ISO-8859-1 for backwards compatibility.<br>
>>> To support this, I think we can add a property like "messageEncoding"<br>
>>> in keycloak-server.json as below. Is it a good idea?<br>
>>><br>
>>> "theme": {<br>
>>> "staticMaxAge": 2592000,<br>
>>> "cacheTemplates": true,<br>
>>> "cacheThemes": true,<br>
>>> "messageEncoding": "ISO-8859-1",<br>
>>> "folder": {<br>
>>> "dir": "${jboss.home.dir}/themes"<br>
>>> }<br>
>>> },<br>
>>><br>
>>> Regards,<br>
>>><br>
>>> On Mon, Jul 4, 2016 at 10:33 PM, Stian Thorgersen <<a href="mailto:sthorger@redhat.com">sthorger@redhat.com</a>><br>
>>> wrote:<br>
>>> > We have in the past discussed this and decided to stick with<br>
>>> > ISO-8859-1.<br>
>>> > That was probably not the best idea though. If we want to change to<br>
>>> > utf-8<br>
>>> > we'd still need to support iso.. for backwards compatibility.<br>
>>> ><br>
>>> > On 4 July 2016 at 14:37, Bruno Oliveira <<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>> wrote:<br>
>>> >><br>
>>> >> It makes sense, maybe file a Jira associated with:<br>
>>> >> <a href="https://issues.jboss.org/browse/KEYCLOAK-3259" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/KEYCLOAK-3259</a> ?<br>
>>> >><br>
>>> >> On 2016-07-04, Hiroyuki Wada wrote:<br>
>>> >> > Hello all,<br>
>>> >> ><br>
>>> >> > I am trying to translate all base theme messages to my country<br>
>>> >> > language, Japanese. And I'd like to contribute them. Before that<br>
>>> >> > work,<br>
>>> >> > I'd like to propose about the files encoding.<br>
>>> >> ><br>
>>> >> > Currently, the message files (*.properties) are loaded with<br>
>>> >> > ISO-8859-1<br>
>>> >> > encoding. Therefore, it is necessary to convert the files by<br>
>>> >> > 'native2ascii' command beforehand. However we can directly read the<br>
>>> >> > property files with UTF-8 encoding in java 1.6 or later because<br>
>>> >> > 'java.util.Properties#load(java.io.Reader)' method was introduced as<br>
>>> >> > below.<br>
>>> >> ><br>
>>> >> ><br>
>>> >> ><br>
>>> >> > <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)" rel="noreferrer" target="_blank">http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)</a><br>
>>> >> ><br>
>>> >> > So, my proposal is supporting the message files with UTF-8 encoding.<br>
>>> >> > I<br>
>>> >> > believe that it's very developers/customers friendly. In addition,<br>
>>> >> > we<br>
>>> >> > can easily review the translated messages on the github pull request<br>
>>> >> > view and so on. What do you think?<br>
>>> >> ><br>
>>> >> > If it's ok, I'll create a JIRA issue and create a pull request.<br>
>>> >> ><br>
>>> >> > Regards,<br>
>>> >> ><br>
>>> >> > --<br>
>>> >> > Hiroyuki Wada,<br>
>>> >> > Developer,<br>
>>> >> > Nomura Research Institute, Ltd.<br>
>>> >> > _______________________________________________<br>
>>> >> > keycloak-dev mailing list<br>
>>> >> > <a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
>>> >> > <a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
>>> >><br>
>>> >> --<br>
>>> >><br>
>>> >> abstractj<br>
>>> >> PGP: 0x84DC9914<br>
>>> >> _______________________________________________<br>
>>> >> keycloak-dev mailing list<br>
>>> >> <a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
>>> >> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
>>> ><br>
>>> ><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> keycloak-dev mailing list<br>
>> <a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>
</div></div></div>