2022-12-06 05:48 PM
Hello,
I'm trying to convert GS::UChar_t to std::string, but i can't get it done.
Usually I use std::string(GS::ValueToString(value).ToCStr()) to convert a Value to string, but if a value is of type GS::UChar_t this method doesn't work.
Could anyone give me a quick work around?
Thanks!
Kind Regards
Dayiz
Solved! Go to Solution.
2022-12-07 04:43 AM
I am use:
std::string CvtAnsi(const GS::UniString& src)
{
return src.ToCStr(0, MaxUSize, CC_System).Get(); // Системная кодировка
}
std::string CvtUtf8(const GS::UniString& src)
{
return src.ToCStr(0, MaxUSize, CC_UTF8).Get();
}
Convert unicode to ansi is not simple stuff, if used any not english language.
The function used System Code page.
2022-12-07 04:43 AM
I am use:
std::string CvtAnsi(const GS::UniString& src)
{
return src.ToCStr(0, MaxUSize, CC_System).Get(); // Системная кодировка
}
std::string CvtUtf8(const GS::UniString& src)
{
return src.ToCStr(0, MaxUSize, CC_UTF8).Get();
}
Convert unicode to ansi is not simple stuff, if used any not english language.
The function used System Code page.
2022-12-07 10:11 AM
Hello Oleg,
Your methods made me notice, that I should just be able to cast GS::Uchar_t to GS::UniString, which is possible and I ended up doing it like that.
Thank you very much for your help 🙂
Kind Regards
Dayiz