S
Simon Posnjak
Hi!
I have a C module for which I created a wrapper with swig. The function def is:
C:
int some_thing(unsigned char * the_str);
eg:
Python:
some_module.some_thing (the_str)
Now I would like to feed it with a UTF-8 formatted string:
test = u'Make \u0633\u0644\u0627\u0645, not war.'
If I try:
some_module.some_thing (test)
I get:
TypeError with message: in method 'some_thing', argument 1 of type
'unsigned char *'
I also tried to pack the string into array or struct but I can not get
it to work.
What would be the best solution for this problem?
[I am working on Windows]
Regards Simon
I have a C module for which I created a wrapper with swig. The function def is:
C:
int some_thing(unsigned char * the_str);
eg:
Python:
some_module.some_thing (the_str)
Now I would like to feed it with a UTF-8 formatted string:
test = u'Make \u0633\u0644\u0627\u0645, not war.'
If I try:
some_module.some_thing (test)
I get:
TypeError with message: in method 'some_thing', argument 1 of type
'unsigned char *'
I also tried to pack the string into array or struct but I can not get
it to work.
What would be the best solution for this problem?
[I am working on Windows]
Regards Simon