cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Convert GS::UChar_t to std::string

Dayiz
Booster

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

1 ACCEPTED SOLUTION
2 REPLIES 2

Solution
Oleg
Advocate

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.

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

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!