Merinn
Merinn

Reputation: 127

Specifying a Character Encoding for Javascript

I am trying to convert a string into uppercase using a specific character encoding, but it fails.

When I convert istanbul, it converts it into ISTANBUL. However, uppercase "i" is "İ" in Turkish. Is there any solution to this?

Demo: http://jsfiddle.net/fgZZp/

Thanks in advance,

Upvotes: 1

Views: 613

Answers (1)

user149341
user149341

Reputation:

To some degree - the JavaScript String class does have a toLocaleUpperCase method, but the locale used is always the user's locale. You can't arbitrarily choose a locale for it to use.

(Nitpick: What you're asking about is a locale issue, not character encoding. Character encoding only has to do with what bits are used to represent a given character; it doesn't generally affect how operations on those characters should behave.)

Upvotes: 4

Related Questions