0

Is it possible to convert characters like ñ, á, é etc to normal English/Latin characters?

ñ should return n
á should return a
é should return e
etc

  • 1
    Did you try searching for a solution? https://stackoverflow.com/a/34792866/4437888 – Matey Sep 28 '17 at 19:16
  • @Matey sorry didnt know exactly what to search. –  Sep 28 '17 at 19:17
  • I feel like this thread provides a great (and simple to follow) solution: https://stackoverflow.com/questions/286921/efficiently-replace-all-accented-characters-in-a-string – JonahAaron Sep 28 '17 at 19:19

2 Answers2

0

Use replace and Regex

var str = "ñ á é ";
undefined
var res = str.replace("ñ", "n").replace("á", "a").replace("é", "e");
undefined
console.log(res);
Deano
  • 11,582
  • 18
  • 69
  • 119
0

Yes you can with replace method. for example

var string = "Buenos días.";

var new_string = string.replace('í', 'i');

console.log(new_string)

if you want to add more character you can add another .replace method in end of new_string.