1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031851: Data Exchange, STEP - enable Unicode symbols in STEP export

Class STEPCAFControl_Writer is corrected to avoid replacing non-Ascii symbols by question marks, and spaces by underscores, on export to STEP.

Related: DRAW commands dealing with strings in OCAF documents are corrected to pass Unicode symbols as UTF-8.

Off-topic: code saving names of external STEP files in XDE and fetching them back is corrected to preserve Unicode symbols as UTF-8.

Added test bugs xde bug31851

Test de step_4 E7 corrected (no more replacement of spaces by underscores in names of layers)
This commit is contained in:
abv
2020-10-14 09:14:04 +03:00
committed by bugmaster
parent 870ae593c3
commit ae9f4b64ca
14 changed files with 62 additions and 79 deletions

View File

@@ -258,11 +258,10 @@ static Standard_Boolean GetLabelName (const TDF_Label &L, Handle(TCollection_HAs
TCollection_ExtendedString name = N->Get();
if ( name.Length() <=0 ) return Standard_False;
// set name, converting it to Ascii and removing spaces
TCollection_AsciiString buf ( name, '?' );
// set name, removing spaces around it
TCollection_AsciiString buf(name);
buf.LeftAdjust();
buf.RightAdjust();
buf.ChangeAll(' ','_');
str->AssignCat ( buf.ToCString() );
return Standard_True;
}
@@ -2385,7 +2384,7 @@ Handle(StepRepr_ShapeAspect) STEPCAFControl_Writer::WriteShapeAspect (const Hand
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString();
Handle(TDataStd_Name) aNameAttr;
if (theLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) {
aName = new TCollection_HAsciiString(TCollection_AsciiString(aNameAttr->Get(), '?'));
aName = new TCollection_HAsciiString(TCollection_AsciiString(aNameAttr->Get()));
Standard_Integer aFirstSpace = aName->Search(" ");
if (aFirstSpace != -1)
aName = aName->SubString(aFirstSpace + 1, aName->Length());