Built-in String Converters in C++11

Ice provides three string converters to cover common conversion requirements:

  • The Unicode wstring converter
    This is a string converter that converts between Unicode wide strings and UTF-8 strings. Unless you install a different string converter, this is the default converter that is used for wide strings.
  • The iconv string converter (Linux, macOS, Unix)
    The iconv string converter converts strings using the iconv conversion facility. It can be used to convert either wide or narrow strings.
  • The Windows string converter (Windows only)
    This string converter converts between multi-byte and UTF-8 strings and uses MultiByteToWideChar and WideCharToMultiByte for its implementation.

These string converters can be created through factory functions in the Ice namespace:

C++
namespace Ice
{ 
    shared_ptr<WstringConverter> createUnicodeWstringConverter();
 
    template<typename charT>
    shared_ptr<BasicStringConverter<charT>> createIconvStringConverter(const std::string& internalCode = "");
 
    shared_ptr<StringConverter> createWindowsStringConverter(unsigned int codepage);
}

See Also