The data exchange interfaces of OpenCascade can work with Unicode characters in filenames if the UTF-8 codepage is used. That explains why all translators expose Standard_CString (const char*) as the input type: it's good enough for UTF-8. Here is how one can convert QString to UTF-8 string to be passed to OpenCascade translators (I assume that Qt is used):
Seemingly obvious, this question pops up from time to time, so I thought it would make sense to answer here.
C++:
TCollection_AsciiString ToAsciiString(const QString& qstr)
{
return ( !qstr.isEmpty() ) ?
TCollection_AsciiString( qstr.toUtf8().data() ) : TCollection_AsciiString();
}
Seemingly obvious, this question pops up from time to time, so I thought it would make sense to answer here.