Salome HOME
bug fix for bos#37741: EDF 28623 : import fails with accent characters
authormbs <martin.bernhard@opencascade.com>
Mon, 25 Sep 2023 17:13:47 +0000 (18:13 +0100)
committermbs <martin.bernhard@opencascade.com>
Mon, 25 Sep 2023 17:13:47 +0000 (18:13 +0100)
src/ExchangePlugin/Test/TestImport.py
src/Model/Model_AttributeString.cpp

index 11944de39c806152c14337f1d453fa65c5ae9c82..56d89bf8804436bfd12343102219ee2f1256bd65 100644 (file)
@@ -156,6 +156,8 @@ if __name__ == '__main__':
         testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5)
         shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "solid.brp"))
         testImport("BRP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5)
+        shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "pièce.brep"))
+        testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5)
         #=========================================================================
         # Create a shape imported from STEP
         #=========================================================================
index c212511d26a67a5d410718ec1302848d3f7b3960..6e20020fe9ccb3453ce4408414c762198673ac9f 100644 (file)
@@ -35,7 +35,9 @@ static const Standard_GUID kUVALUE_IDENTIFIER("04cac509-b2fc-4887-b442-d2a86f2fd
 
 void Model_AttributeString::setValue(const std::string& theValue)
 {
-  TCollection_ExtendedString aValue(theValue.c_str());
+  // Always assume the std::string to be a multi-byte character string
+  // as it can contain accents or other special characters, too!
+  TCollection_ExtendedString aValue(theValue.c_str(), true);
   if (!myIsInitialized || myString->Get() != aValue) {
     if (myString.IsNull())
       myString = TDataStd_Name::Set(myLab, TCollection_ExtendedString());