From 241b1234365e3f65b9b84c7c8eccf072be54b68c Mon Sep 17 00:00:00 2001 From: mbs Date: Mon, 25 Sep 2023 18:13:47 +0100 Subject: [PATCH] bug fix for bos#37741: EDF 28623 : import fails with accent characters --- src/ExchangePlugin/Test/TestImport.py | 2 ++ src/Model/Model_AttributeString.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ExchangePlugin/Test/TestImport.py b/src/ExchangePlugin/Test/TestImport.py index 11944de39..56d89bf88 100644 --- a/src/ExchangePlugin/Test/TestImport.py +++ b/src/ExchangePlugin/Test/TestImport.py @@ -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 #========================================================================= diff --git a/src/Model/Model_AttributeString.cpp b/src/Model/Model_AttributeString.cpp index c212511d2..6e20020fe 100644 --- a/src/Model/Model_AttributeString.cpp +++ b/src/Model/Model_AttributeString.cpp @@ -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()); -- 2.39.2