@ -191,7 +191,7 @@ directive. If the directive is not specified then <tt class="xref docutils lite
<p>Python v3 will use the <ttclass="docutils literal"><spanclass="pre">bytes</span></tt> type to represent the argument if the
encoding is <ttclass="docutils literal"><spanclass="pre">"None"</span></tt> and the <ttclass="docutils literal"><spanclass="pre">str</span></tt> type otherwise.</p>
<p>Python v2 will use the <ttclass="docutils literal"><spanclass="pre">str</span></tt> type to represent the argument if the
encoding is <ttclass="docutils literal"><spanclass="pre">"None"</span></tt> and the <ttclass="docutils literal"><spanclass="pre">tqunicode</span></tt> type otherwise.</p>
encoding is <ttclass="docutils literal"><spanclass="pre">"None"</span></tt> and the <ttclass="docutils literal"><spanclass="pre">unicode</span></tt> type otherwise.</p>
<dd>Convert a C/C++ <ttclass="docutils literal"><spanclass="pre">L'\0'</span></tt> terminated wide character string to a Python
v2 tqunicode object or a Python v3 string object. If the string pointer
v2 unicode object or a Python v3 string object. If the string pointer
is <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> then the result is <ttclass="docutils literal"><spanclass="pre">Py_None</span></tt>.</dd>
<dd>Convert a Python string-like object of length 1 to a C/C++ <ttclass="docutils literal"><spanclass="pre">char</span></tt>
according to the encoding <ttclass="docutils literal"><spanclass="pre">e</span></tt>. <ttclass="docutils literal"><spanclass="pre">e</span></tt> can either be <ttclass="docutils literal"><spanclass="pre">A</span></tt> for ASCII,
<ttclass="docutils literal"><spanclass="pre">L</span></tt> for Latin-1, or <ttclass="docutils literal"><spanclass="pre">8</span></tt> for UTF-8. For Python v2 the object may be
either a string or a tqunicode object that can be encoded. For Python v3
either a string or a unicode object that can be encoded. For Python v3
the object may either be a bytes object or a string object that can be
encoded. An object that supports the buffer protocol may also be used.</dd>
<dd>Convert a Python v2 string or unicode object or a Python v3 string
object to a C/C++ <ttclass="docutils literal"><spanclass="pre">L'\0'</span></tt> terminated wide character string. If the
Python object is <ttclass="docutils literal"><spanclass="pre">Py_None</span></tt> then the string is <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>.</dd>
<dd>Convert a Python v2 string or unicode object or a Python v3 string
object to a C/C++ wide character array and its length. If the Python
object is <ttclass="docutils literal"><spanclass="pre">Py_None</span></tt> then the array and length are <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and zero
<h2>Support for Wide Characters<aclass="headerlink"href="#support-for-wide-characters"title="Permalink to this headline">¶</a></h2>
<p>SIP v4.6 introduced support for wide characters (i.e. the <ttclass="docutils literal"><spanclass="pre">wchar_t</span></tt> type).
Python’s C API includes support for converting between tqunicode objects and wide
character strings and arrays. When converting from a tqunicode object to wide
Python’s C API includes support for converting between unicode objects and wide
character strings and arrays. When converting from a unicode object to wide
characters SIP creates the string or array on the heap (using memory allocated
using <atitle="sipMalloc"class="reference external"href="c_api.html#sipMalloc"><ttclass="xref docutils literal"><spanclass="pre">sipMalloc()</span></tt></a>). This then raises the problem of how this memory