RE: utf 8 on language translations

Arun Pandian, modified 5 Years ago. Junior Member Posts: 72 Join Date: 9/26/19 Recent Posts
Hi, when i add custom language key the data is displaying irrelevent

eg : Sélectionner une langue <--- expected
But it is displaying as  s�lectionnez une langue
any idea what should be done here?
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Contrary to other properties-files encodings, Liferay's translation properties files need to be UTF-8 encoded
Arun Pandian, modified 5 Years ago. Junior Member Posts: 72 Join Date: 9/26/19 Recent Posts
can you give me an example regarding this i am not quite understand where i should encode whether add some properties in hook? or convert the text to utf-8 text like /u2019 instead of '
thumbnail
Vahid Kh, modified 5 Years ago. Junior Member Posts: 54 Join Date: 8/6/19 Recent Posts
You can easily create a text file with utf-8 encoding and then change its extension to *.properties
Arun Pandian, modified 5 Years ago. Junior Member Posts: 72 Join Date: 9/26/19 Recent Posts
in my properties file it is displaying as utf8 encoded string

Sélectionner une langue  <--- in my properties file


also in my hook i have used utf8 encode

@Component(        property = { "language.id=fr_FR" }, service = ResourceBundle.class)
public class FrenchHook extends ResourceBundle {    ResourceBundle bundle = ResourceBundle.getBundle("content.Language", UTF8Control.INSTANCE);    @Override
    protected Object handleGetObject(String key) {
        return bundle.getObject(key);
    }

and in my tomcat setenv.sh i have set utf8 encoding 


and in the system properties inside the portel it is utf-8 encoding.
but in the application when a user views it it is displaying as s�lectionnez une langue

this is my problem emoticon
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
That you see the content in the file correctly does not mean that it is actually UTF-8 encoded. You need to check if the properties file is actually UTF-8 encoded.
Are you using Eclipse?
If so, right click the resource file and click "Properties". It will show you the encoding of the file. Is it actually UTF-8?
Note: There are some other editors that can help too, I think, Notepad++ also detects the file encoding correctly.
Arun Pandian, modified 5 Years ago. Junior Member Posts: 72 Join Date: 9/26/19 Recent Posts
That resolved the issue ty