简体   繁体   中英

Converting character encoding within c++

I have a website which allows users to input usernames.

The problem here is that the code in c++ assumes the browser encoding is Western Europe and converts the string received from the username text box into unicode to compare with string stored within the databasse.

with the right browser encoding set the character úser is recieved as %FAser and coverted properly to úser within the program however with the browser settings set to UTF-8 the string is recieved as %C3%BAser and then converted to úser due to the code converting C3 and BA as seperate characters.

Is there a way to convert the example %c3%BA to ú while ensuring the right conversions are being made?

You can use the ICU library to convert between almost all usable encodings. This library also provides lots of string manipulation facilities.

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