I am working with a class that wraps the std::wstring, this code needs to be cross platform, are there equivalents to the windows functions: MultiByteToWideChar & WideCharToMultiByte on linux?
Thank you.
The Linux equivalents are the iconv
functions iconv_open
, iconv
and iconv_close
(say man 3 iconv_open
etc. for the documentation). For cross-platform applications, use dedicated libraries such as ICU instead. Such libraries already contain their own string classes; there is no need to wrap std::wstring
.
mbtowc
和wctomb
是最直接的等价物,但请注意它们对应于当前LC_CTYPE
语言环境(可以使用setlocale()
更改setlocale()
的多字节字符集进行操作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.