Project

Profile

Help

Output encoding for C++ methods returning char*?

Added by Martin Honnen 15 days ago

The recent releases, for some Python API methods returning a string, do provide an optional encoding parameter e.g. https://www.saxonica.com/saxon-c/doc12/html/saxonc.html#PyXsltExecutable-call_function_returning_string says

Also accept the keyword 'encoding' (str) to specify the encoding of the output string.

Shouldn't the C++ API also provide such an output encoding option? https://www.saxonica.com/saxon-c/doc12/html/classXsltExecutable.html#a09d680ae5cb1c895d760c85c4056f12f doesn't have it.

Or is the C++ API user supposed to get a char* that is UTF-8 and has to use whatever C++ library method to convert to some other encoding/string result?

It might well be that that is a naive question from someone not having enough experience with C++, particularly cross-platform, but I have struggled an hour to get the result of SaxonProcessor->version() to be converted on Windows to some wchar_t to display it correctly in an MFC control.

Now I wonder what effort I will have to make to convert any string result I get from the SaxonC C++ API for XSLT and XQuery to something renderable in the MFC controls.


Please register to reply