[Qt-interest] problem with accents
Andrew Maclean
andrew.amaclean at gmail.com
Tue Aug 4 00:37:06 CEST 2009
Try using trUtf8.
QString str = trUTf8(file.readLine());
I haven't tested it but it may work.
Andrew
On Tue, Aug 4, 2009 at 7:15 AM, mierdatutis mi<mmm286 at gmail.com> wrote:
>
> Thanks!
>
> No, I don't use QtextStream. I do:
>
> while (!file.atEnd()) {
>
> QTableWidgetItem *item = new QTableWidgetItem;
>
> QByteArray line = file.readLine();
>
> item->setText(line);
>
> tabla->setItem(b,0,item);
>
> tabla->setRowHeight(b,20);
>
> b++;
>
> }
>
> 2009/8/3 Brad Howes <howes at ll.mit.edu>
>>
>> On Aug 3, 2009, at 4:23 PM, mierdatutis mi wrote:
>>
>>> I have a file with text with accents.
>>>
>>> When I pass the information of the file to a qtablewidget, the text have
>>> strange characters instead of accents.
>>>
>>> How could I have the same text that the file in my qtablewidget?
>>
>> Apparently, you have a Unicode format mismatch: your file's data is
>> encoded in one format and Qt expects data in another. Are you using
>> QTextStream to do the reading of the file?
>>
>> Brad
>>
>> --
>> Brad Howes
>> Group 42
>> MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
>> Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420
>>
>>
>>
>>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________
More information about the Qt-interest-old
mailing list