Problem with string conversion to UaString type when using Japanese characters
Posted: 04 Oct 2022, 15:46
Hello all,
Thank you for let me write in this forum.
I am running a piece of code like this:
//"input_BSTR" parameter is a BSTR type variable
auto var_bstrt = _bstr_t(input_BSTR);
auto var_wchart = static_cast<wchar_t*>(var_bstrt);
auto var_wchart_2 = var_wchart;
//This next line of code is the one giving me problems
UaString result_UaString = var_wchart_2;
I am passing into "input_BSTR" a string with Japanese characters. When I read the "result_UaString" the Japanese characters on it have been modified.
So, my questions are:
- Is there a way to convert a BSTR (or _bstr_t) string to a UaString string without changing the Japanese characters? So, in my code, this would be convert "input_BSTR" (or "var_bstrt") to "result_UaString"
- If the previous point is not possible, would it be possible to convert from a std::wstring to a UaString (without changing the Japanese characters inside)?
Thank you very much for your help. It is really appreciated.
Best regards,
Ignacio
Thank you for let me write in this forum.
I am running a piece of code like this:
//"input_BSTR" parameter is a BSTR type variable
auto var_bstrt = _bstr_t(input_BSTR);
auto var_wchart = static_cast<wchar_t*>(var_bstrt);
auto var_wchart_2 = var_wchart;
//This next line of code is the one giving me problems
UaString result_UaString = var_wchart_2;
I am passing into "input_BSTR" a string with Japanese characters. When I read the "result_UaString" the Japanese characters on it have been modified.
So, my questions are:
- Is there a way to convert a BSTR (or _bstr_t) string to a UaString string without changing the Japanese characters? So, in my code, this would be convert "input_BSTR" (or "var_bstrt") to "result_UaString"
- If the previous point is not possible, would it be possible to convert from a std::wstring to a UaString (without changing the Japanese characters inside)?
Thank you very much for your help. It is really appreciated.
Best regards,
Ignacio