简体   繁体   中英

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,

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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM