artemp/trac2github — Issue #164: Support for Unicode Strings as arguments
Author: artemp
Created: 2011-10-09 20:17:31+00:00
State: open
Labels: Boost_Python_Binding

I'm hitting snags in a web dev project when I forget to turn arguments in python that are automatically unicode strings into true strings because boost::python std::string does not, obviously, support unicode strings:

{{{
>>> from mapnik import Projection
>>> Projection('+init=EPSG:900913')

>>> unicode_string = unicode('+init=EPSG:900913')
>>> epsg = unicode('+init=EPSG:900913')
>>> epsg
u'+init=EPSG:900913'
>>> Projection(epsg)
Traceback (most recent call last):
File "", line 1, in
Boost.Python.ArgumentError: Python argument types in
Projection.__init__(Projection, unicode)
did not match C++ signature:
__init__(_object*)
__init__(_object*, std::string)
}}}