I'm trying to make a Java application, and the VS C ++ application exchanges data and sends different messages to each other using Sockets. The only problem that I still have is that I am completely lost in my encodings.
By default, Java uses UTF-8. This applies to Unicode encoding. In my VS project, I have settings set in Unicode. Although for some reason, when I debug my code, I always see that my lines are encoded as CP1252 in memory. Moreover, if I try to use CP1252 in Java, it is great for English letters, but whenever I try to write some Russian letters, I get a byte 3ffor each letter. If on the other hand, I try to use UTF-8 in Java - each English letter is 1 byte long, but each Russian is 2 bytes long. Isn't that a multibyte encoding?
Some C ++ docs say they std::string(char)use the UTF-8 code page and std:wstring(wchar_t)- UTF-16. When I debug my application, I see CP1252 encoding for both of them, although wstring has empty bytes between each letter.
Could you explain how coding behaves in both Java and C ++, and how can I tell my 2 applications?
black source
share