Copy link to clipboard
Copied
My code output text to 1 file:
If FileName not include UTF8 Text (Ex: 1.html), it output OK,
But FileName include UTF8 Text (Ex: 名称未設定-1.indd_1.html), it can't create file.
How can output filename include UTF8 Text?
WideString strContent=WideString("test名称未設定");
PMString filename="C:/Users/pc1/Desktop/cc/名称未設定-1.indd_1.html";
std::string utf8StdStr;
StringUtils::ConvertWideStringToUTF8(strContent, utf8StdStr);
std::string strfile;
StringUtils::ConvertWideStringToUTF8(WideString(filename), strfile);
std::ofstream fileOut(strfile);
if (!fileOut)
{
ASSERT_FAIL("ofstream failed.");
break;
}
fileOut << utf8StdStr;
fileOut.close();
Copy link to clipboard
Copied
Hello,
Shouldn't your filename be
"C:\\Users\\pc1\\Desktop\\cc\\名称未設定-1.indd_1.html"
instead ?
Also, did you try saving to a basic folder, in case there are user rights permissions issues with saving to the desktop ?
Very best regards,
Olivier
Copy link to clipboard
Copied
It can create file, but filename output not correct:
Input: 名称未設定-1.indd_1.html
Output: ヨシマ誇「ム旁ィ-1.indd_1.html
Copy link to clipboard
Copied
Try pre-pending it with L.
L"C:\\Users\\pc1\\Desktop\\cc\\名称未設定-1.indd_1.html"
Copy link to clipboard
Copied
I had try, but occur error:
Error C2440 'initializing': cannot convert from 'const wchar_t [56]' to 'PMString'