Cyrillic error when export to STEP

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?

Attachments: 
gkv311 n's picture

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.

Vladimir Ivanov's picture

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.

Vladimir Ivanov's picture
   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";
    }
 }
Vladimir Ivanov's picture

Everything worked, I just changed it std::string filename to the QString filename.
And IFSelect_ReturnStatus aStat = aWriter.Write (filename.toStdString().c_str());

gkv311 n's picture

Wouldn't make much difference, but QString::toUtf8() might look more explicit:

QString filename = ...;
IFSelect_ReturnStatus aStat = aWriter.Write (filename.toUtf8().data());