Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79220

Re: [Tutor] Convert Qstring to string in windows

Return-Path <dyoo@hashcollision.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; '16,': 0.03; 'url:sourceforge': 0.03; 'subject:: [': 0.04; 'beginner': 0.05; 'string': 0.09; 'conversions': 0.09; 'converted': 0.09; 'correct,': 0.09; 'strings.': 0.09; 'subject:string': 0.09; 'way:': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'windows': 0.15; 'class:': 0.16; 'programmers,': 0.16; 'qt,': 0.16; 'subject:Convert': 0.16; 'subject:Tutor': 0.16; 'subject:windows': 0.16; 'url:qt-4': 0.16; 'url:qt-project': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'skip:p 40': 0.19; 'thu,': 0.19; 'subject:] ': 0.20; 'seems': 0.21; 'handles': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'library,': 0.24; 'unicode': 0.24; 'fine': 0.24; 'question': 0.24; 'cc:no real name:2**0': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'correctly.': 0.31; 'received:209.85.212': 0.32; 'text': 0.33; 'linux': 0.33; 'says': 0.33; 'received:209.85': 0.35; 'something': 0.35; 'convert': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'doing': 0.36; 'url:org': 0.36; 'should': 0.36; 'list.': 0.37; 'received:209': 0.37; 'mapping': 0.38; 'fact': 0.38; 'anything': 0.39; 'sure': 0.39; 'mailing': 0.39; 'according': 0.40; 'manually': 0.60; 'conversion': 0.61; 'information,': 0.61; "you're": 0.61; 'you.': 0.62; 'more': 0.64; 'specialized': 0.65; 'here': 0.66; 'experience.': 0.67; 'you:': 0.81; 'characters,': 0.84; 'skip:\xc3 10': 0.91
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=i6mWh7acNDtNy/0OcjA2eqCZ8AHmgUefYHHjgXjFRNo=; b=RPKFZ5eKNXicPZR8MJ6MeoBL5WK+iutr94Nuwa10sMwPMS8IOMlGhdYzlabYtPPh/l XvSMzmZ7bGg82PdD/00EZ3kbAFhkP/8g7M9aXp+qtXbTeecG4/773yAH2qcFxs8AJE7g SczrsB8VL/TCND2CHKyCO9zGrHKeEWWGIMQHE0FIBAF+Y7XtoQ1wjXP4GkrurlTwuAtP WG6OftBv7PQd2M/CrLVFRaLxavTgJVPLUYxRrjcixMPllKdCADrRZg7WgxoOTUOxR6dV fl9gKHjtGXUxn2NkyTB6Pbz6778VZ/K70t0ige1zJbcFocCOyn4L312Md9s4Ph7cl93h rbRA==
X-Gm-Message-State ALoCoQlcCZjvOX+9nYzC4Zf7/Xza+vdLHMMsxKNdgYtbcoV3Z1HOFqaM/iQb8amjfu9AzEamotCQ
X-Received by 10.180.77.79 with SMTP id q15mr22668141wiw.8.1413483284400; Thu, 16 Oct 2014 11:14:44 -0700 (PDT)
X-Received by 10.181.27.161 with SMTP id jh1mr7796825wid.75.1413483282428; Thu, 16 Oct 2014 11:14:42 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <969535236.13984943.1413472898089.JavaMail.zimbra@estudiantes.uci.cu>
References <1549164247.13980291.1413472329833.JavaMail.zimbra@estudiantes.uci.cu> <969535236.13984943.1413472898089.JavaMail.zimbra@estudiantes.uci.cu>
From Danny Yoo <dyoo@hashcollision.org>
Date Thu, 16 Oct 2014 11:14:22 -0700
Subject Re: [Tutor] Convert Qstring to string in windows
To "C@rlos" <cmferras@estudiantes.uci.cu>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org, Python Tutor Mailing List <tutor@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14929.1413483291.18130.python-list@python.org> (permalink)
Lines 53
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413483291 news.xs4all.nl 2929 [2001:888:2000:d::a6]:42471
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:79220

Show key headers only | View raw


On Thu, Oct 16, 2014 at 8:21 AM, C@rlos <cmferras@estudiantes.uci.cu> wrote:
>
> I have been tryed to convert a Qstring text to string on python, in linux
> that work fine but in windows when qstring contine á,é,í,ó,ú the converted
> text is not correct, contine extranger characters,
> this qstring text is an url from qdialogtext.
>
> in linux i do for this way:
> pythonstringtext=qstringtext.text().toUtf8.data()
> and it return a python string correctly.


Hi Carlos,

This seems like a question that's very specific to Qt: you may want to
ask on a Qt-Python mailing list.  Tutor is intended for beginner
programmers, and the question you're asking seems a bit specialized
for the intended audience.


In absence of this information, I have to make a few guesses.  My best
guesses so far are that you're working with Qt, which provides its own
Unicode string class:

    http://qt-project.org/doc/qt-4.8/qstring.html

Are you using PyQt 4 or PyQt 5, or something else entirely?  Are you
using Python 2 or Python 3?

According to the PyQt5 documentation, it automatically handles the
string conversion:

    http://pyqt.sourceforge.net/Docs/PyQt5/gotchas.html#python-strings-qt-strings-and-unicode

and according to the PyQt 4 documentation, it also handles the
conversion automatically for you:

    http://pyqt.sourceforge.net/Docs/PyQt4/python_v3.html#qstring

and because the mapping is done by the library, you should not have to
be doing anything on your own end to convert Qstrings to Python
strings.


Yeah, I am not sure what you are doing yet, because the documentation
says that it handles conversions for you.  The fact that you're doing
this manually suggests that you might be doing something unusual.  We
need more information.  But I think you may get better help on a
Qt-specific mailing list; I suspect very few of us here have Qt
experience.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Tutor] Convert Qstring to string in windows Danny Yoo <dyoo@hashcollision.org> - 2014-10-16 11:14 -0700

csiph-web