user1065440
user1065440

Reputation: 1

Swedish letters encoding in different browsers

I have developed a website in which I use jQuery to get a value from a textbox (it is an input tag with attribute: type=text). The reason for this is that I use a the $.get() function and I use the value of the textbox as part of the url, which i use to search a database. This can be a problem if the letters are not in ASCII, so i manually convert the swedish letters 'åäö' to 'char01' etc. to work around it. This is how it looks:

        vTxtBox = vTxtBox.replace("%C3%A5","char11");
        vTxtBox = vTxtBox.replace("%C3%A4","char12");
        vTxtBox = vTxtBox.replace("%C3%B6","char13");

The problem is that some of my users still experience problems with this so my question is: Is it possible that some browsers are set to interpret 'åäö' in something else than unicode?

Thanks in advance

Upvotes: 0

Views: 906

Answers (1)

Pekka
Pekka

Reputation: 449703

Replacing characters manually like this is not necessary. Use encodeURIComponent() on every one of your values instead.

See whether that already fixes the problem - if your current page is in UTF-8, things should work. If it doesn't work, come back with more details about the exact problems your users experience.

Upvotes: 1

Related Questions