Nostale DMG counter + website

02/02/2021 15:53 Bledis#1
Hi, we are having Nostale DMG counter injected through DLL which counts some data on raids, total dmg, gold, etc...

When raid ends we are sending data to our website through API in JSON format.

Here is the problem:

Short:
Convert dynamic encoding std::string to utf-8 including special characters like ™.

Long:
JSON is in utf-8 format, so all data should be utf-8 too. All data is stored in variable C++ std::string and to my knowledge encoding of std::string depends on some things that are unknown to me(sometimes utf-8, utf-16, utf-32, windows..., and maybe more?). I tried convert them but with fail, special characters like ™ are being converted to wrong characters in utf-8. Anyone ideas?

Note: nicknames are displayed correctly in DMG counter (DLL).

Some screeshots if anyone is curious how it looks.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
02/02/2021 22:06 WalrossGreat#2
You need to convert those values from your local windows codepage like win1252 to utf-8 before displaying it on the website
02/03/2021 00:14 Bledis#3
Are you sure that std::string is always windows1252 when on Windows OS?

Is there any good library for this? I tried almost all code from stackoverflow etc... and nothing works in my case.
02/03/2021 05:36 Apourtartt#4
Are you sure the encoding issue comes from your program and not from your site ? If you try to display an utf8 character on your console, even if the character is valid, you'll probably get some weird result.
What if you try to send to your server something like const char* test = u8"™" or const char* test = L"™" ?
02/03/2021 11:09 Bledis#5
When I send std::string = u8"™" it works. So its issue with dynamic std::string.
02/03/2021 12:34 WalrossGreat#6
Quote:
Originally Posted by Bledis View Post
Are you sure that std::string is always windows1252 when on Windows OS?
No it's not. std::string doesn't have any predefined encoding, it's just array of bytes. Run debugger and see what are the codes of those special characters, then compare it to some codepages like windows1252 and check if it is matching.
02/09/2021 10:28 doddo978#7
Quote:
Originally Posted by Bledis View Post
Hi, we are having Nostale DMG counter injected through DLL which counts some data on raids, total dmg, gold, etc...

When raid ends we are sending data to our website through API in JSON format.

Here is the problem:

Short:
Convert dynamic encoding std::string to utf-8 including special characters like ™.

Long:
JSON is in utf-8 format, so all data should be utf-8 too. All data is stored in variable C++ std::string and to my knowledge encoding of std::string depends on some things that are unknown to me(sometimes utf-8, utf-16, utf-32, windows..., and maybe more?). I tried convert them but with fail, special characters like ™ are being converted to wrong characters in utf-8. Anyone ideas?

Note: nicknames are displayed correctly in DMG counter (DLL).

Some screeshots if anyone is curious how it looks.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Hi man, can u share this project with us?
02/12/2021 12:47 Bledis#8
I might share if I have a good reason.
02/13/2021 20:54 doddo978#9
Like helping the community?
I see your project very nice and it could help NosTale players to organize marathons talking about the web side