ClipX – Software Development Kit

Frequently Asked Questions



How to convert from UTF8 to UNICODE ?

#include <bfc/string/encodedstr.h>
// ...
String utf8_string;
// ...
EncodedStr es;
es.convertFromUTF8(SvcStrCnv::UTF16, utf8_string);
// es.getEncodedBuffer() now returns the UNICODE string

How to convert from UNICODE to UTF8 ?

#include <bfc/string/encodedstr.h>
// ...
EncodedStr es(SvcStrCnv::UTF16, unicode_string, WSTRLEN(unicode_string) + 1, 0); // you must give the size of the string PLUS the null term if any.
String utf8_string;
es.convertToUTF8(utf8_string);
// utf8_string now contains the string in UTF8 format

How to convert from ANSI to UTF8 ?

#include <bfc/string/encodedstr.h>
// ...
EncodedStr es(SvcStrCnv::OSNATIVE, unicode_string, STRLEN(ansi_string) + 1, 0); // you must give the size of the string PLUS the null term if any.
String utf8_string;
es.convertToUTF8(utf8_string);
// utf8_string now contains the string in UTF8 format



Back to documentation index