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

@@ -65,12 +65,8 @@ static Standard_Integer DDocStd_ListDocuments (Draw_Interpretor& di,
A->GetDocument(i,D);
di <<"document " << i;
if (D->IsSaved()) {
TCollection_AsciiString GetNameAsciiString(D->GetName().ToExtString(),'?');
TCollection_AsciiString GetPathAsciiString(D->GetPath().ToExtString(),'?');
//std::cout << " name : " << D->GetName();
//std::cout << " path : " << D->GetPath();
di << " name : " << GetNameAsciiString.ToCString();
di << " path : " << GetPathAsciiString.ToCString();
di << " name : " << D->GetName();
di << " path : " << D->GetPath();
}
else di << " not saved";
di << "\n";
@@ -428,18 +424,10 @@ static Standard_Integer DDocStd_Path (Draw_Interpretor& di,
{
if (nb == 2) {
TDocStd_PathParser path (a[1]);
//std::cout << "Trek : " << path.Trek() << std::endl;
//std::cout << "Name : " << path.Name() << std::endl;
//std::cout << "Extension : " << path.Extension() << std::endl;
//std::cout << "Path : " << path.Path() << std::endl;
TCollection_AsciiString TrekAsciiString(path.Trek().ToExtString(),'?');
TCollection_AsciiString NameAsciiString(path.Name().ToExtString(),'?');
TCollection_AsciiString ExtensionAsciiString(path.Extension().ToExtString(),'?');
TCollection_AsciiString PathAsciiString(path.Path().ToExtString(),'?');
di << "Trek : " << TrekAsciiString.ToCString() << "\n";
di << "Name : " << NameAsciiString.ToCString() << "\n";
di << "Extension : " << ExtensionAsciiString.ToCString() << "\n";
di << "Path : " << PathAsciiString.ToCString() << "\n";
di << "Trek : " << path.Trek() << "\n";
di << "Name : " << path.Name() << "\n";
di << "Extension : " << path.Extension() << "\n";
di << "Path : " << path.Path() << "\n";
return 0;
}
di << "DDocStd_Path : Error\n";
@@ -484,9 +472,7 @@ static Standard_Integer DDocStd_PrintComments (Draw_Interpretor& di,
for (int i = 1; i <= comments.Length(); i++)
{
//std::cout << comments(i) << std::endl;
TCollection_AsciiString commentAsciiString(comments(i).ToExtString(),'?');
di << commentAsciiString.ToCString() << "\n";
di << comments(i) << "\n";
}
return 0;

View File

@@ -311,7 +311,7 @@ static Standard_Integer DDocStd_DumpDocument (Draw_Interpretor& di,
di << "\n";
// document name
if (D->IsSaved())
di << "DOCUMENT : " << TCollection_AsciiString(D->GetName(),'?').ToCString();
di << "DOCUMENT : " << D->GetName();
else
di << "DOCUMENT : not saved";
di << "\n";

View File

@@ -266,20 +266,17 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer
else if ( att->IsKind(STANDARD_TYPE(TDataStd_Name)) )
{
Handle(TDataStd_Name) val = Handle(TDataStd_Name)::DownCast ( att );
TCollection_AsciiString str ( val->Get(), '?' );
di << str.ToCString();
di << val->Get();
}
else if ( att->IsKind(STANDARD_TYPE(TDataStd_Comment)) )
{
Handle(TDataStd_Comment) val = Handle(TDataStd_Comment)::DownCast ( att );
TCollection_AsciiString str ( val->Get(), '?' );
di << str.ToCString();
di << val->Get();
}
else if ( att->IsKind(STANDARD_TYPE(TDataStd_AsciiString)) )
{
Handle(TDataStd_AsciiString) val = Handle(TDataStd_AsciiString)::DownCast ( att );
TCollection_AsciiString str ( val->Get(), '?' );
di << str.ToCString();
di << val->Get();
}
else if ( att->IsKind(STANDARD_TYPE(TDataStd_IntegerArray)) )
{