cancel
Showing results for 
Search instead for 
Did you mean: 

i18n strange encoding

0 Kudos

Hi guys,

I was doing some testing on i18n encoding.

I wrote a german word: "Hinzufügen" but when sapui5 reads it, it becomes "Hinzuf�gen"

What is wrong with this?

I have set it correctly.

var model = new sap.ui.model.resource.ResourceModel({bundleUrl : "test.properties", bundleLocale : "de" });

sap.ui.getCore().setModel(model, "i18n");



Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

A Deeper search and I found a way to convert the properties file.

As the properties file needs to be in escape Unicode in order to work,

i have used the native2ascii tool from JDK to do so.

hope this finding can help others too!

former_member707385
Participant
0 Kudos

Hi Chris,

iam facing this issue.Can yo please let me know how to acheive this.

How will I change the encoding type of my i18n file.

Regards,
Anand

0 Kudos

Hi Anand,
If i recall correctly, i was using this tool.
https://docs.oracle.com/javase/8/docs/technotes/tools/windows/native2ascii.html

it has been 6 years since i have touched SAPUI5. I really doubt you would still need this tool as i expect SAPUI5 to handle this natively. Have you try the below different approaches mentioned by the others?

former_member707385
Participant
0 Kudos

Hi Chris,

Thanks a lot for your reply. Its ok I too understand its too long.

As of now I am manually providing the unicode value in my i18n file.

As per below suggestions I do not know how can I save my i18n file as UTF-8.

Regards,

Anand

Answers (5)

Answers (5)

former_member88235
Participant
0 Kudos

As mentioned the language property files themselves has to be saved as UTF-8 files, too. Then, there is no need to escape the umlauts in the property files. You can convert them easily with Notepad++ (for example).

0 Kudos

Yes I have tried them and the \u… is working.

But why do I have to do that?

Is that a way to make this work without having to change all the unicode 8 characters?

Can I change it in the js level on how UI5 is loading the properties?

Qualiture
Active Contributor
0 Kudos

You can do that, but you need to make sure you save your files in Unicode / UTF8 encoding too

Former Member
0 Kudos

Hi Chris,

can you try defining your i8n value as Hinzuf\u00FCgen instead of Hinzufügen

Regards

Sakthivel

SandipAgarwalla
Active Contributor
0 Kudos

are you using utf-8 encoding?

in the index.html - head section ,  mention

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>

0 Kudos

Yes html has this meta tag.

Former Member
0 Kudos

hi Chris,

same is the problem i am facing, when implementing i18n for french.

the output in chrome shows for any special character. i have tried everything with the meta tag in index.html but all futile.

Although, if i alert any special character  with the character replaced by its special code, like &12sc; within the controller, the special character appears in alert.

All i think is that, we need to write a logic in the formatter function, which will read if the word has any special character, and if so replace the special character with its code.

Pl update if you get any breakthrough.

Regards,

Viren