title: From C++ buffer to python::boost::list
body: <p>I am trying to convert a C++ buffer to a python::boost::list, my C++ class is:</p>
  
  <pre><code>#include "boost/python/list.hpp"
  
  using namespace boost::python;
  
  class Buffer {
  public:
      unsigned char* m_pBuff;
      int m_iWidth;
      int m_iHeight;
  
  
      Buffer( cont int p_iWidth, const int p_iHeight ) {
          m_pBuff = new unsigned char[p_iWidth * p_iHeight];
  
          m_iWidth  = p_iWidth;
          m_iHeight = p_iHeight;
      }
  
      ~Buffer() { delete[] m_pBuff; }
  
      /* Class Functions */
  
      list getList ( void ) {
          list l;
          l.append(m_iWidth);
          l.append(m_iHeight);
  
          std::string data(m_iWidth * m_iHeight, ' ');
  
          unsigned char* pBuff = m_pBuff;
          for ( int i = 0; i &lt; m_iWidth * m_iHeight; ++i, ++pBuff ) {
              data[i] = (char*) *pBuff;
          }
  
          l.append(data);
  
          return l;
      }
  };
  </code></pre>
  
  <p>And the python boost module is defined as:</p>
  
  <pre><code>using namespace boost::python;
  
  BOOST_PYTHON_MODULE(BufferMethods)
  {
  
      class_&lt;Buffer&gt;("Buffer", init&lt;const int, const int&gt;()) 
          .add_property("width", &amp;Buffer::m_iWidth)
          .add_property("height", &amp;Buffer::m_iHeight)
          /* Other functions */
          .def("getList", &amp;Buffer::getList)
      ;
  }
  </code></pre>
  
  <p>But when I run the module in python it return this error:</p>
  
  <pre><code>&gt;&gt;&gt; from BufferMethods import *
  &gt;&gt;&gt; Buff = Buffer(800, 600)
  &gt;&gt;&gt; dataList = Buff.getList()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 0: invalid continuation byte
  &gt;&gt;&gt;
  </code></pre>
  
  <p>What I am doing wrong?? I am using python 3.3.</p>