Copy link to clipboard
Copied
I want to read the current document binary data In MacOS X,this is my code:
ai::FilePath file;
sAIDocument->GetDocumentFileSpecification(file);
std::string localFilePahtName = file.GetFullPath().as_Platform();
std::ifstream files( localFilePahtName.c_str(),std::ios_base::binary|std::ios_base::in);
if (files.is_open()==false ) return -1;
else
{
// do something
}
......
If the file name contains only Latin ,like "\abc\file.ai " ,there is no problem,
but If the file name contains Chinese,like "\abc\你好.ai",
files.is_open() == false,
and return -1;
This only occurs in mac platform,In Windows, would not have this happen。
Who can help me, where is the problem?
I believe the problem is you want as_UTF8() not as_Platform(). I'm 99% sure that MacOS uses UTF8 for all their file path stuff, and as_Platform() will be in the local encoding, not UTF8. Place to start at any rate ![]()
Copy link to clipboard
Copied
I believe the problem is you want as_UTF8() not as_Platform(). I'm 99% sure that MacOS uses UTF8 for all their file path stuff, and as_Platform() will be in the local encoding, not UTF8. Place to start at any rate ![]()
Copy link to clipboard
Copied
A. Patterson ,thank you.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more