Function cras::iconvConvert
Defined in File string_utils.hpp
Function Documentation
-
::std::string cras::iconvConvert(const ::std::string &toEncoding, const ::std::string &fromEncoding, const ::std::string &inText, bool translit = false, bool ignore = false, double initialOutbufSizeScale = 1.0, double outbufEnlargeCoef = 2.0, const ::std::optional<::std::string> &localeName = ::std::nullopt)
Convert
inTextfromfromEncodingtotoEncodingusing iconv.- Parameters:
toEncoding – The target encoding. It may contain the //TRANSLIT and //IGNORE suffixes.
fromEncoding – The source encoding.
inText – The text to convert.
translit – If true, the conversion will try to transliterate letters not present in target encoding.
ignore – If true, letters that can’t be converted and transliterated will be left out.
initialOutbufSizeScale – The initial scale of the size of the output buffer. Setting this to the correct value may speed up the conversion in case the output is much larger than the input.
outbufEnlargeCoef – The step size to use for enlarging the output buffer if it shows that its initial size is insufficient. Must be strictly larger than 1.0.
localeName – If set, specifies the locale used for the iconv call. It may influence the transliteration results. If not set, a default english locale is used that usually works quite well.
- Returns: