PDA

View Full Version : Get unicode string with QSslSocket



nhocjerry
14th September 2013, 05:17
I am working with QSslSocket to get Gmail emails. I want to check all folders in server:



QSslSocket::write("tag LIST \"\" \"*\"");


The output is:



* LIST (\HasChildren) "/" "INBOX"
* LIST (\HasNoChildren) "/" "INBOX/Test1"
* LIST (\HasNoChildren) "/" "INBOX/Test2"
* LIST (\Noselect \HasChildren) "/" "[Gmail]"
* LIST (\HasNoChildren \All) "/" "[Gmail]/Alle Nachrichten"
* LIST (\HasNoChildren \Drafts) "/" "[Gmail]/Entw&APw-rfe"
* LIST (\HasNoChildren \Sent) "/" "[Gmail]/Gesendet"
* LIST (\HasNoChildren \Flagged) "/" "[Gmail]/Markiert"
* LIST (\HasChildren \Trash) "/" "[Gmail]/Papierkorb"


Then I want to select one of those folder, I select INBOX folder for example:



QSslSocket::write("tag SELECT INBOX");


It works fine, but when I select folder "[Gmail]/Entw&APw-rfe", it does not work anymore. I think the problem is the encoding of text "Entw&APw-rfe" (in unicode is "Entwürfe"). So how can I get exactly the name of the folder in unicode and input it in command? Does Qt have a library to process this?
Thanks for help!

anda_skoa
14th September 2013, 10:49
Identify the encoding being used, check the list of supported text codecs http://qt-project.org/doc/qt-5.0/qtcore/qtextcodec.html

Cheers,
_