swig/Examples/test-suite/unicode_strings.i
William S Fulton 01611702ec Python 2 Unicode strings can be used as inputs to char * or std::string types
Requires SWIG_PYTHON_2_UNICODE to be defined when compiling generated code.
2015-12-19 03:55:26 +00:00

23 lines
326 B
OpenEdge ABL

%module unicode_strings
%include <std_string.i>
%begin %{
#define SWIG_PYTHON_2_UNICODE
%}
%inline %{
const char* non_utf8_c_str(void) {
return "h\xe9llo w\xc3\xb6rld";
}
std::string non_utf8_std_string(void) {
return std::string("h\xe9llo w\xc3\xb6rld");
}
char *charstring(char *s) {
return s;
}
%}