When translating German special characters to English using latinize, the module only works when strings are passed within single or double quotes. However, it does not work when storing them inside a variable.
import latinize from 'latinize';
Within the render, I tested this and it worked perfectly,
console.log('render', latinize('VfL Osnabrück'))
It also worked fine when I passed my
let tag_name = 'VfL Osnabrück';
console.log('render', latinize('VfL Osnabrück'))
However, it did not work properly when retrieving the tag_name from my API. The complete code is provided below:
let tag_parsing = sub_category_id.split('%20');
let tag_string = '';
for (let i = 0; i < tag_parsing.length; i++) {
tag_parsing[i];
console.log('latinized text', tag_parsing[i]);
tag_string += ' ' + tag_parsing[i]
}
OUTPUT
Output of the latinized text ==> Osnabr%C3%BCck
Output of the latinized text inside quotes ==> Osnabruck
https://i.sstatic.net/0UIrK.pnghttps://i.sstatic.net/CojAW.png I also attempted using .toString() but it did not work as expected