zoukankan      html  css  js  c++  java
  • ffmpeg默认输出中文为 UTF-8

    在使用ffmpeg 进行对音视频文件解码输出信息的时候会出现乱码。

    从网上找到了说ffmpeg默认格式 为 utf-8 

    如果vs工程使用的的 Unicode 则需要将 utf-8转 Unicode 才能正常显示中文格式。

    下面是一个简单的 Unicode 转utf-8 代码:

    CString UTF82WCS(const char* szU8)
    {
        //预转换,得到所需空间的大小;
        int wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), NULL, 0);
    
        //分配空间要给''留个空间,MultiByteToWideChar不会给''空间
        wchar_t* wszString = new wchar_t[wcsLen + 1];
    
        //转换
        ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), wszString, wcsLen);
    
        //最后加上''
        wszString[wcsLen] = '';
    
        CString unicodeString(wszString);
    
        delete[] wszString;
        wszString = NULL;
    
        return unicodeString;
    }
  • 相关阅读:
    C#学习(四)
    C#学习(三)
    sqlserver基本操作
    ado.net(1)
    wpf的学习日志(一)
    C#学习(二)
    三大范式
    存储过程
    事务
    范文模板
  • 原文地址:https://www.cnblogs.com/wainiwann/p/8065774.html
Copyright © 2011-2022 走看看