unicode如何转换成ANSI?

来源:百度知道 编辑:UC知道 时间:2024/05/22 05:23:50
记事本保存的时候提示保存成ANSI时会使里面原有的UNICODE字符消失,若保存成UNICODE的话放在MP3里无法辩识..如何解决?

将unicode编码的文章打开,单击工具栏的【文件】,选择【另存为】,在页面最下方的【编码】栏设置即可

Win32 提供 MultiByteToWideChar 和 WideCharToMultiByte 将为 Unicode 的 ANSI 字符串和 Unicode 字符串转换为 ANSI。代码如下:

/*
 * AnsiToUnicode converts the ANSI string pszA to a Unicode string
 * and returns the Unicode string through ppszW. Space for the
 * the converted string is allocated by AnsiToUnicode.
 */ 

HRESULT __fastcall AnsiToUnicode(LPCSTR pszA, LPOLESTR* ppszW)
{

    ULONG cCharacters;
    DWORD dwError;

    // If input is null then just return the same.
    if (NULL == pszA)
    {