For all issues regarding the Forums use, please, refer to the Forum Rules.
Need professional assistance?
Need to speed up your development?
Have a look at our:
Samples & Tools
Need some functionality extending standard OCCT capabilities?
Check out our:
What can I do in order to make opencascade support chinese file path?
Opencascade can not open file under chinese file path now .
I had this problem too. In order to work around it in my application I'm creating a temporary directory, then copying the file to that temporary directory and reading it from there.
On Linux I get a file path that looks like this: "/var/my-application-name/import-file.stp" - so it only contains ASCII characters and can be read without any problem.
Note that this workaround will not help if the users are running Windows and have non-ASCII-characters in their username as the temporary path there will be "C:\Users\USERNAME\AppData\Local\Temp\my-application-name".
Hope this helps!
If you use Windows, you might try to use the short path name, which if I remember correctly only consists of ascii letters:
wstring strStepFile = L"Some Chinese Name.stp"
wcstombs(strFileName, strStepFile.c_str(), _MAX_PATH);
if (strchr(strFileName, '?') != NULL)
::GetShortPathNameW(strStepFile .c_str(), strShortPath,
wcstombs(strFileName, strShortPath, _MAX_PATH);
Thanks for your help! I have tried you method but it also can not read chinese file path.
I checked opencascade's source file and found that it is the type OSD_Path that can not surpport
chinese characters. Because chinese character is multi-bytes and opencascade read file path with Standard_Character,So it can not read chinese character. I need change opencascade's code if I want
improve the problem.
It can be setteled by this way : in the file OSD_Path.cxx there is a function named systemname, change the code
for ( i = j = 1; i
for ( i = j = 1; i
can rebuild the project,then it is oK!
Thanks for tips, but I can't see the changes you mentioned?
Could you explain clearly?
Convert the path string to UTF8
It works. Thank you so much!
A Capgemini Group Company
Copyright © 2017 OPEN CASCADE SAS