LoadString with Non-ASCII character

Questions about Wine on Linux
Locked
backfire
Newbie
Newbie
Posts: 1
Joined: Sat Mar 05, 2022 4:02 pm

LoadString with Non-ASCII character

Post by backfire »

Hi All

I run a Ubuntu 18.04 docker with wine 7.0.0.0 installed.

I am trying to create a program with resource files in languages with non-ascii characters (e,g, Korean)
I use LoadString (due to some restriction I have to use multi-byte character set, not unicode set so this should be a LoadStringA) to load the resource file string table and put what I get into a char array

This works fine when I tried in in Windows (Win10, built with VS2017)

However it does not work when I take to the docker (Ubuntu 18.04, wine 7.0.0.0)
I set everything in locale to Korean (ko_KR.UTF-8) in the Ubuntu docker

I debug and find the the char array coming from LoadString is already wrong
I tried to use LoadStringW to get it into a wchar_t which seems fine, but when I use MultiByteToWideChar to convert it to char array it got the same wrong result

Any idea to make it working as char array? I suspect this is not a code problem but somewhat configuring either in Ubuntu or Wine is missing
hotfrostworm
Level 2
Level 2
Posts: 15
Joined: Fri Nov 06, 2020 3:20 pm

Re: LoadString with Non-ASCII character

Post by hotfrostworm »

I am a bit confused here.

Are you compiling a Windows program in C++ using Wine or a program in C++ to be used with Ubuntu? It seems like you have 3 different tools here in the mix. When you say docker, I assume you are talking about Docker.com the Linux desktop sharing developer's desktop? Then you are using C++ terminology. Tossing Wine into to the soup makes for a multitude of debugging on a grand scale.

A lot depends on your compiler version you are using. G++ copy the bytes from the source file; the string literally will be in whatever encoding mode your editor used to save. As I recall, C++ has UTF-8 string literals, which would allow you to write u8"your text", and be ensured that "your text" was encoded in UTF-8. The end user needs to have the ko_KR.UTF-8 installed or the program will display gibberish characters.

I took some time to look up a fair example of UTF-8 string literals in C++ https://stackoverflow.com/questions/688 ... 008#696026
I hope that helps.
Locked