On Thu, Oct 16, 2014 at 10:21 AM, C@rlos <cmfer...@estudiantes.uci.cu> wrote:
> in linux i do for this way:
> pythonstringtext=qstringtext.text().toUtf8.data()
> and it return a python string correctly.

pythonstringtext is a byte string that has to be decoded as UTF-8.
Here's the 'mojibake' result when it gets decoded as UTF-16LE or
Windows codepages 850 and 1252:

    >>> s = u'áéíóú'
    >>> b = s.encode('utf-8')

    >>> print b.decode('utf-16le')
    ꇃ꧃귃돃뫃

    >>> print b.decode('850')
    ├í├®├¡├│├║

    >>> print b.decode('1252')
    áéíóú

The native character size in the Windows kernel is 2 bytes, so UTF-16
is the path of least resistance for in-memory strings used with GUI
controls and file/registry paths. UTF-8 is preferred for text data in
files and network communication.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to