Hello. When exporting to STEP, if there is Cyrillic in the file name, then these characters are replaced with hieroglyphs, how can this be fixed?
Discussion
5 archived replies
Posts are displayed in their archived order.
01Commenter-1
Please share the code in plain text (insert as code snippet in Markdown for formatting), not as screenshots to show respect to other users on the forum.
Make sure that your std::string filename contains UTF-8 string, not some locale encoding. Share the code where this parameter is initialized to get more hints what could be broken there.
02Author
Sorry, I'll add the code later, for some reason it is inserted incorrectly.
Now I'll try to check what you advised about the encoding.
03Author
void RKOpenCascade::exportStepInternal(TopoDS_Shape& shape, Handle(TDocStd_Document) doc, std::string filename)
{
if (shape.IsNull() == true)
{
throw new std::invalid_argument("Can't export null shape to STEP");
}
STEPControl_Controller::Init();
Interface_Static::SetCVal("write.step.schema", "AP214");
STEPControl_StepModelType aMode = STEPControl_AsIs;
STEPCAFControl_Writer aWriter;
if (!aWriter.Transfer (doc, aMode))
{
std::cout << "Error while transferring shape to STEP.\n";
}
IFSelect_ReturnStatus aStat = aWriter.Write (filename.c_str());
if (aStat != IFSelect_RetDone)
{
std::cout << "Error while writing transferred shape to STEP file.\n";
}
}
04Author
Everything worked, I just changed it std::string filename to the QString filename.
And IFSelect_ReturnStatus aStat = aWriter.Write (filename.toStdString().c_str());
05Commenter-1
Wouldn't make much difference, but QString::toUtf8() might look more explicit: