Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
mitk::Utf8Util Namespace Reference

Functions

MITKCORE_EXPORT std::string Local8BitToUtf8 (const std::string &local8BitStr)
 Convert a string encoded with the current code page to an UTF-8 encoded string (Windows) More...
 
MITKCORE_EXPORT std::string Utf8ToLocal8Bit (const std::string &utf8Str)
 Convert a UTF-8 encoded string to a string encoded with the current code page (Windows) More...
 

Function Documentation

◆ Local8BitToUtf8()

MITKCORE_EXPORT std::string mitk::Utf8Util::Local8BitToUtf8 ( const std::string &  local8BitStr)

Convert a string encoded with the current code page to an UTF-8 encoded string (Windows)

The conversion happens on Windows only. On all other platforms, the input string is returned unmodified as it is assumed to be UTF-8 encoded already.

If the conversion fails, a warning is printed and the input string is returned instead. This matches the behavior before this method was introduced.

◆ Utf8ToLocal8Bit()

MITKCORE_EXPORT std::string mitk::Utf8Util::Utf8ToLocal8Bit ( const std::string &  utf8Str)

Convert a UTF-8 encoded string to a string encoded with the current code page (Windows)

The conversion happens on Windows only. On all other platforms, the input string is returned unmodified as strings are assumed to be always UTF-8 encoded by default.

If the conversion fails, a warning is printed and the input string is returned instead. This matches the behavior before this method was introduced.