How to decode this string in javascript

2

I get this string in the frontend, but I need to decode it.

Tr%E1%BA%A7n_H%C6%B0ng_%C4%90%E1%BA%A1o -> Trần Hưng Đạo

I do not know any function to decode it.

    
asked by anonymous 18.09.2018 / 14:42

1 answer

5

Try to use the decodeURIComponent function:

conteudo = "Tr%E1%BA%A7n_H%C6%B0ng_%C4%90%E1%BA%A1o"

console.log(decodeURIComponent(conteudo))
    
18.09.2018 / 14:44