Skip to content Skip to sidebar Skip to footer

How To Put Å, Ä And Ö In A Javascript Array And Then Compare It With Html Text?

I want to put Å, Ä and Ö. And then compare them using html text. For example text has these characters, and i want to compare my text using javascript array. I am trying to make

Solution 1:

Instead of storing string literals in the array, store their unicode representations:

var myArray = ['\u197', '\u196', '\u214'];

I used this website to convert your ASCII symbols to unicode.

Solution 2:

If your Javascript code is in a separate file than your HTML, you'll need to make sure that all of your files are using the same character encoding (e.g. utf-8). If you are using literals like this, you'll have to force your editor to use the correct encoding.

What editor are you using?

Post a Comment for "How To Put Å, Ä And Ö In A Javascript Array And Then Compare It With Html Text?"