dimanche 26 juin 2016

C++ utf16 Unicode escape sequence


So I have multiple strings that I need to send to my mysql database. But unfortunately some of characters are encoded in utf16. I already have made the column where the string are going in utf16.

This is what I need to process, what i start with:

"StatTraku2122 AK-47 | Aquamarine Revenge (Factory New)"

What I get when I pass it trough the output stream cout:

"StatTrak™ AK-47 | Aquamarine Revenge (Factory New)"

What I want in my database:

"StatTrak™ AK-47 | Aquamarine Revenge (Factory New)"

What I get in my database:

"StatTraku2122 AK-47 | Aquamarine Revenge (Factory New)"

What I get in my database when I escape it:

"StatTraku2122 AK-47 | Aquamarine Revenge (Factory New)"

I do not only have a trademark symbol I need to send to my database. I also have others like: u2605 () , u58f1 (), etc.

I need this because I want to show it in a GUI and otherwise I can't make a valid requests at the steam API (You need to be logged in): https://steamcommunity.com/market/pricehistory/?country=BE&currency=3&appid=730&market_hash_name=StatTrak%E2%84%A2%20AK-47%20|%20Aquamarine%20Revenge%20(Factory%20New)

I got all the names from opskins: https://opskins.com/pricelist/730.json

So my question is: What do I need to do to get this in my database ?

(PS i am on ubuntu using c++11)


Aucun commentaire:

Enregistrer un commentaire