STEPControl_Reader Reader;
IFSelect_ReturnStatus status = aReader.ReadFile(FileName);
If I run the above, then I always get the error code "IFSelect_RetError". However, if I run the above with a filepath with only english characters,
("C:\Users\jgregory\Desktop\test\stepfile.stp") then I never see this issue and the step file is opened properly. All of this is done on a Japanese Windows 10 machine.
Are there any ideas that I could try? I did not have this issue formerly with OCD 6.5.3 but only noticed that it happens with OCC 7.8
Any help would be appreciated, I've tried lots of things to no avail.
Discussion
6 archived replies
Posts are displayed in their archived order.
01Commenter-1
I suppose that CString is a class from MFC. In that case:
Make sure that your application is build using MFC Unicode, not legacy MFC MBCS.
OCCT expects strings in either UTF-8 (Standard_CString or TCollection_AsciiString) or UTF-16 (TCollection_ExtendedString).
Make sure to implement a proper conversion between MFC CString and OCCT strings - you may examine MFC sample coming with OCCT as a reference.
While hard-coding Unicode string in C++ file, make sure that file encoding is one from Unicode subset (not local codepage), MSVC compiler is aware in which encoding the file (probably file should start with BOM), C++ string has proper encoding prefix (like L"" or u8""). In general, it is better to avoid hard-coding Unicode string into C++ source code to avoid portability issues.
Thank you for your assistance. When I try to convert the character set to use unicode in out mfc application, I get lots of compiler errors. To use MFC Unicode, I switched this setting "Character Set" to "Use Unicode Character Set".
Is there a workaround to still use MFC multibyte while also still being able to use the STEPControl_Reader with OCC 7.8?
03Commenter-2
Hello. If you are having trouble with path string, then you can use "iostream" to read by open stream instead.
But originally, UTF-8 must to be work without issues. You can use as a bridge TCollection_ExtendedString then create AsciiString. Or use constructor, which takes pointer and length.
Best regards, Commenter-2.
04Commenter-3
Hi,
you could try to convert CString to Unicode via MultiByteToWideChar and CP_ACP as codepage parameter to wchar_t.
Then create a TCollection_AsciiString as shown above: