qt中文件路径的编码
Encoding of filepath in qt
我正在编写读取WAV文件的方法。当我像"E:\waffile.wav"一样将它与文件路径一起使用时,它工作得很好。但是路径可以包含带有俄语符号(cp1251)的:
"E:/谷歌驱动器/谷歌Диск/РАБОТА/IP-PHONE/vaneev/guncans.wav"
void WAV::open(QString path)
{
qDebug() << path; // in console displayed valid path
FILE *pFile = fopen(path.toStdString().c_str(),"rb"); // but there is an error
路径如下所示:
E:/GoogleDrive/GoogleР"РСРДР"/РРАР'РУРўР/IP-PHONE/vaneev/guncans.wav
我该怎么解决这个问题?(我使用QT)
听起来像是在从PercentEncoding或toEncoded 中寻找
void WAV::open(QString path)
{
FILE *pFile = fopen(path.toLocal8Bit(),"rb");
我刚刚使用了方法toLocal8Bit()。它起作用了!
相关文章:
- 如何确定我已使用非编码文件到达 EOF?
- 如何将更多文件夹添加到c++include路径
- 带有特殊路径部分的"std::filesystem::weakly_canonical"失败
- C++A*算法并不总是在路径中具有目标节点
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 从函数角度看ID到文件路径的内部与外部映射
- 在卡萨布兰卡形成编码参数的列表
- boost xml parsingl将xml的路径作为变量发送
- 对于MacOS上的G++,如何添加默认的include目录/usr/local/include和默认的库搜索路径/usr
- 如何使用cppcheck处理半相对包含路径
- C++和带有国家符号的文件路径(也许用 UTF8 编码)
- 共享库依赖于具有硬编码路径的其他库
- 管理代码中的硬编码文件路径/名称
- qt中文件路径的编码
- 在Linux上使用文件路径字符串,使用什么编码
- 在静态库中硬编码的代码文件和头路径
- 将LLVM添加到我的Cmake项目中:为什么LLVM的Cmake文件中有硬编码路径?
- 从Makefile中的c可执行文件中删除硬编码的路径
- TagLib -如何处理UTF-8编码的文件路径
- 对于不遵循libNAME.so命名约定的库,如何使用不带-l或硬编码路径的GCC进行链接