nefch
nefch

Reputation: 3

How do I convert a char* to a char* that is UTF-8 encoded?

Under Windows I use MultiByteToWideChar(CP_ACP, ...) and WideCharToMultiByte(CP_UTF8, ...) for the conversion.

How do I do the same thing under OS X and Linux? I tried mbstowcs/wcstombs but the resulting char* is not UTF-8.

Upvotes: 0

Views: 463

Answers (1)

bmargulies
bmargulies

Reputation: 100151

Look into iconv(3). that's the api you want. You'll need -liconv.

Upvotes: 3

Related Questions