Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / How can opencascade support chinese file path ?

How can opencascade support chinese file path ?

How can opencascade support chinese file path ?
SunHongLei 2013/03/07 12:10
What can I do in order to make opencascade support chinese file path?
Opencascade can not open file under chinese file path now .
Marko Knöbl 2013/03/07 13:43
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!
Göran Barz 2013/03/11 11:23
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"
char strFileName[_MAX_PATH];
wcstombs(strFileName, strStepFile.c_str(), _MAX_PATH);
if (strchr(strFileName, '?') != NULL)
{
wchar_t strShortPath[_MAX_PATH];
::GetShortPathNameW(strStepFile .c_str(), strShortPath,
_MAX_PATH);
wcstombs(strFileName, strShortPath, _MAX_PATH);
}
SunHongLei 2013/03/11 12:17
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.
SunHongLei 2013/03/12 14:55
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 <= myTrek.UsefullLength() && j <= _MAX_PATH; ++i, ++j )
to
for ( i = j = 1; i <= myTrek.Length() && j <= _MAX_PATH; ++i, ++j )

can rebuild the project,then it is oK!
 
 
Latest news
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map