I am having problems with UTF8 characters while using SanitizeValueStrategy('sanitize')
. I have to use it since the client is using the language files to edit texts and he might use tags like <b>
or <i>
...
I need to use only the json file for translations. The client won't touch the app code to change any text. JSON file:
{
"H1": "Typy domů",
"NAME": "Křestní"
}
The problems, thought, only occurs while using angular's interpolation:
<h1 translate>houseTypes.H1</h1>
Typy domů
I can use this method to put text inside of element's body, but this problems still occurs for attributes.
<input placeholder="'houseTypes.NAME'|translate"></h1>
Křestní
The questions is:
How can I get UTF8 characters to be written correctly, while only using the JSON static file loader in interpolations, or any other way in attributes as is placeholder
.
For anyone struggeling upon finding way how to make UTF-8 character normal even in {{interpolations}}
, this is the way to do it:
$translateProvider.useSanitizeValueStrategy('sanitizeParameters');
This way the sanitize will be always made even in interpolations.
You have two options:
For me the problem was solved when i set SanitizeValueStrategy to null
$translateProvider.useSanitizeValueStrategy(null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With