In my server application I am trying to parse my responses with UTF-8 in Greek but since my local char set is 1254 thus I can not reach every Greek character.
I tried setting my threads local as 1253 but it did not work. I want to know if there is a way to convert UTF-8 string to windows.1253(Greek) in my 1254 char set machine just for certain client responses.
By the way when I change my regional setting to Greek I do not have any problem but I can not follow this solution cause my local setting should remain as windows.
Update based on comments:
This is the response I get in UTF-8
"Valuation_Date":"10\/10\/2019 12:00:00 πμ"
This is how my application gets it
"Valuation_Date":"10\/10\/2019 12:00:00 πμ"
Code that this string gets through after its Unicode wstring
std::string returnGivenCodePage(const std::wstring &unicodeString)
{
std::string result;
int numberOfBytesNeeded = WideCharToMultiByte(1253, WC_NO_BEST_FIT_CHARS,
unicodeString.c_str(), (int)unicodeString.length(),
NULL, 0, NULL, NULL);
int numberOfBytesWritten = WideCharToMultiByte(1253, WC_NO_BEST_FIT_CHARS,
unicodeString.c_str(), (int)unicodeString.length(),
&result[0], numberOfBytesNeeded, NULL, NULL);
return result;
}
and finnaly this is the version after I change it to SystemWindowsAnsi which is 1253(Greek Locale) but my default local is 1254(Turkish)
<ValuationDate>10/10/2019 12:00:00 ğì</ValuationDate>
And of course this is just a small part of really big response.
Actually what I want is converting UTF-8 string to windows 1253(Greek) and after processing on it again converting UTF-8 string my current default local is 1254(Turkish).
If you need further information I'll glad to share some more.