MantisBT - Community
View Issue Details
0029069Community[OCCT] OCCT:Samplespublic2017-08-31 15:432018-06-29 21:19
sgiesel 
apn 
normalminor 
closedfixed 
PCWindows 7Build 7601
[OCCT] 7.1.0 
[OCCT] 7.3.0[OCCT] 7.3.0 
Not needed
0029069: Samples - handle UNICODE filenames within C++/CLI CSharp sample
When loading a step file with special characters like ä,Ü,á,... OpenCascade will return with a failure.
1. Rename a step file to for example Inválid.step
2. Try to open it with the STEPCAFControl_Reader::Perform() with the path to the invalid stepfile
3. It always returns false
No tags attached.
related to 0027585closed apn Community It is not possible to store OCAF documents to paths with special characters in their names 
child of 0022484closed bugmaster Open CASCADE UNICODE characters support. 
Issue History
2017-08-31 15:43sgieselNew Issue
2017-08-31 15:43sgieselAssigned To => gka
2017-10-09 09:53abvRelationship addedduplicate of 0027585
2017-10-09 10:04abvNote Added: 0071290
2017-10-09 10:04abvAssigned Togka => sgiesel
2017-10-09 10:04abvStatusnew => feedback
2017-10-13 08:55sgieselNote Added: 0071390
2017-10-13 13:11abvNote Added: 0071410
2017-10-13 13:18abvNote Added: 0071411
2017-10-13 13:18abvAssigned Tosgiesel => apn
2017-10-13 13:18abvStatusfeedback => assigned
2017-10-13 13:18abvCategoryOCCT:Data Exchange => OCCT:Samples
2017-10-13 13:18abvTarget Version => 7.3.0
2018-01-29 10:43kgvRelationship addedchild of 0028851
2018-01-29 10:44kgvRelationship addedrelated to 0029143
2018-01-29 10:44kgvFile Added: occ_wpf_sample.png
2018-01-29 11:03kgvSeveritycrash => minor
2018-01-29 11:03kgvSummaryOpenCascase can't load step-files with some special characters => Samples - handle UNICODE filenames within C++/CLI CSharp sample
2018-01-29 11:14gitNote Added: 0073640
2018-01-29 11:16kgvRelationship deletedrelated to 0029143
2018-01-29 11:16kgvRelationship replacedrelated to 0028851
2018-01-29 11:17kgvRelationship replacedrelated to 0027585
2018-01-29 11:18kgvRelationship addedchild of 0022484
2018-01-29 11:57kgvNote Added: 0073642
2018-01-29 11:57kgvAssigned Toapn => abv
2018-01-29 11:57kgvStatusassigned => resolved
2018-01-29 11:57kgvAdditional Information Updatedbug_revision_view_page.php?rev_id=18529#r18529
2018-01-29 11:58kgvFile Deleted: occ_wpf_sample.png
2018-01-31 11:25gitNote Added: 0073692
2018-01-31 11:34abvNote Added: 0073693
2018-01-31 11:34abvAssigned Toabv => bugmaster
2018-01-31 11:34abvStatusresolved => reviewed
2018-01-31 13:26apnTest case number => Not needed
2018-01-31 13:26apnNote Added: 0073696
2018-01-31 13:26apnStatusreviewed => tested
2018-02-03 18:59apnChangeset attached => occt master 95f68826
2018-02-03 18:59apnAssigned Tobugmaster => apn
2018-02-03 18:59apnStatustested => verified
2018-02-03 18:59apnResolutionopen => fixed
2018-02-05 11:39gitNote Added: 0073765
2018-02-05 11:39gitNote Added: 0073766
2018-06-29 21:15aivFixed in Version => 7.3.0
2018-06-29 21:19aivStatusverified => closed

Notes
(0071290)
abv   
2017-10-09 10:04   
I cannot reproduce the problem with the file named "InválidäÜá.stp": the file gets opened correctly in Import Export sample (both MFC or Qt) in OCCT 7.1.0 (as well as 7.0.0 and 7.2.0). The problem may occur with some other symbols in 7.1.0 -- this is known issue 0027585, fixed in OCCT 7.2.0.

Please check if the problem is resolved in OCCT 7.2.0.

If the problem still persists, please describe more precisely how to reproduce it.
(0071390)
sgiesel   
2017-10-13 08:55   
It seems like the error only occurs when you wrap OCCT into a C#-Layer.
Most likely because the string is interpreted as another charset.

If you use ASCII-Charset instaed of Unicode the error stills exists in the 7.1-branch

Here a minimal running example:
#include "TCollection_AsciiString.hxx"

#include "TDocStd_Document.hxx"
#include "XCAFApp_Application.hxx"
#include "STEPCAFControl_Reader.hxx"
#include <iostream>

using namespace std;
using namespace opencascade;
int main(int argc, const char* argv[]) {

    auto filename = "C://temp//Inválid.step"; [^] // <-- If you're using a wchar_t no error will be thrown

    auto format = TCollection_ExtendedString("MDTV-XCAF");
    auto stepDocument = TDocStd_Document(format);
    auto docHandle = handle<TDocStd_Document>(&stepDocument);
    auto app = XCAFApp_Application::GetApplication();
    app->NewDocument(format, docHandle);
    auto stepReader = STEPCAFControl_Reader();
    auto result = stepReader.Perform(filename, docHandle);
    if (result != true)
    {
        cout << "Error.";
        stepReader.Reader().PrintCheckLoad(false,
            IFSelect_PrintCount::IFSelect_GeneralInfo);
    }
    else
    {
        cout << "No Error!";
    }

    return 0;
}

So it seems like that without any additional wrapping-metadata the C#-Wrapper will use the ASCII-Method and fail.
(0071410)
abv   
2017-10-13 13:11   
When wrapping to C# is concerned, Unicode strings can be passed correctly to C# level, but the way to do that depends on method used for the wrapping.

So should I consider the issue as resolved and close it?
(0071411)
abv   
2017-10-13 13:18   
Oops, I see: it does not work in C# samples in OCCT 7.1 or 7.2
(0073640)
git   
2018-01-29 11:14   
Branch CR29069 has been created by kgv.

SHA-1: f01a0f38fb04474aa1204efb9da9937b2ab9e445


Detailed log of new commits:

Author: kgv
Date: Mon Jan 29 11:05:20 2018 +0300

    0029069: Samples - handle UNICODE filenames within C++/CLI CSharp sample
(0073642)
kgv   
2018-01-29 11:57   
Patch is ready for review.

http://jenkins-test-10.nnov.opencascade.com/view/CR29069-master-KGV/ [^]
(0073692)
git   
2018-01-31 11:25   
Branch CR29069_1 has been created by kgv.

SHA-1: 08584c5516e98e995efb2ad8d415105b5e7fa6a7


Detailed log of new commits:

Author: kgv
Date: Mon Jan 29 11:05:20 2018 +0300

    0029069: Samples - handle UNICODE filenames within C++/CLI CSharp sample
(0073693)
abv   
2018-01-31 11:34   
No remarks, please integrate
(0073696)
apn   
2018-01-31 13:26   
Combination -
OCCT branch : CR29069_1 SHA - 08584c5516e98e995efb2ad8d415105b5e7fa6a7
Products branch : master SHA - 9d16afb77be76e276e46b7b3fc08eb16a4eea45e
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings
(0073765)
git   
2018-02-05 11:39   
Branch CR29069 has been deleted by kgv.

SHA-1: f01a0f38fb04474aa1204efb9da9937b2ab9e445
(0073766)
git   
2018-02-05 11:39   
Branch CR29069_1 has been deleted by kgv.

SHA-1: 08584c5516e98e995efb2ad8d415105b5e7fa6a7