[Qt-interest] problem with accents

mierdatutis mi mmm286 at gmail.com
Tue Aug 4 07:27:14 CEST 2009


Hi again,

If I write:

 QString str = trUTf8(file.readLine()); or

QString str = toUtf8(file.readLine());


it says me :

"error: 'trUTf8: doens't declare in this scope";


If I write:

 QString str;

str.toUtf8(file.readLine());

it says  me:
desn't find a coincident function to the call to
'QString::toUtf8(QByteArray)'

Any help please?
Many thanks!



2009/8/4 Andrew Maclean <andrew.amaclean at gmail.com>

> 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/
> ___________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090804/b41e9215/attachment.html 


More information about the Qt-interest-old mailing list