trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2016

Re: [trinity-devel] Re: TQString::fromUtf8 vs TQString::fromLatin1 [possible bug in parseVCard]

From: Fat-Zer <fatzer2@...>
Date: Sat, 26 Mar 2016 09:46:11 +0300
2016-03-25 3:58 GMT+03:00 deloptes <deloptes@...>:
> Hi all,
>
> ...
>
> However this works in my test program
>
>         std::string teststr(newItem.ascii());
>         std::cout << teststr << "\n";
>
> and this contradicts the logic of ascii all ��� are there
>
Nope, it doesn't... see the ascii () documentation: �If a codec has
been set using QTextCodec::codecForCStrings(), it is used to convert
Unicode to 8-bit char. Otherwise, this function does the same as
latin1().�
However you generally shouldn't use ascii() unless either you are
positive that string contains only ascii chars or some over interface
accepts strictly those and you doesn't care about others...