在Linux中等效于什么

在Linux中等效于什么

本文介绍了在Linux中等效于什么:MultiByteToWideChar& WideCharToMultiByte?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个包装std :: wstring的类,该代码需要跨平台,是否与Windows函数等效:MultiByteToWideChar& Linux上的WideCharToMultiByte?

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?

谢谢.

推荐答案

Linux等效项是iconv函数 iconv_open iconv iconv_close (对于文档,请说man 3 iconv_open等).对于跨平台应用程序,请使用专用的库,例如 ICU .这样的库已经包含了自己的字符串类.无需包装std::wstring.

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.

这篇关于在Linux中等效于什么:MultiByteToWideChar& WideCharToMultiByte?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 09:11