Skip to content
  • 0 Votes
    3 Posts
    113 Views
    C

    @sayan275 said in QLineedit adding extra \ from text():

    qInfo()<<__FUNCTION__<<textentered;

    When you use the QDebug functions the output is in the form of a C++ literal with anything that would need to be escaped inside the double-quotes, escaped. In this case the backslashes, but also any embedded double quote etc.

  • 0 Votes
    14 Posts
    1k Views
    Christian EhrlicherC

    @Aramir said in QRegExp returning incorrect position due to codec ?:

    ve seen many SD cards/emmc die in ereaders (devices I'm aiming for) therefore I'm trying to lower the write operations on it in order to not reduce their lifetime. That's it I think it's worth the trouble to figure out a solution to this problem instead of creating more and more e-waste.

    Again a useless optimization due to a feeling. Optimize only when you can prove it's a problem and needs to be optimzied.

    You SD-Card has likely a sector size of 512 or 1024 bytes. On top of this your filesystem may use a block size up to 64kb (NTFS, ext4 use 4kb ). So when you even change single byte in your file which is less than the sector size or block size it will write the whole sector/block.
    It's just plain stupid and an over-complicating of things for nothing.

  • 0 Votes
    5 Posts
    387 Views
    S

    The ellipsis are showing up correctly now that I'm using a consistent compiler for my tests.
    I still have many bugs to fix, but got the first release out the door.
    Thanks again for all of your help!

  • 0 Votes
    8 Posts
    3k Views
    Q

    The solution to that problem is to insert the following call to the constructor of the file processing class:

    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

    Concerning the shell:
    I use BusyBox (its light) which doesn't provide locale and the environment variables like LANG=en_US.UTF-8.
    For compiling BusyBox configurations can or have to be given containing

    CONFIG_LAST_SUPPORTED_WCHAR=0

    the number is the last displayable number of the Unicode list, 0 signifies that all characters shall be displayed, it was set to 767 which includes west European characters. The excluded characters are replaced by the character defined in the same configs, in my case it is "?".

  • 0 Votes
    8 Posts
    3k Views
    UnitScanU

    [SOLVED]

    Replace

    playlist->load(QUrl::fromLocalFile("C:/Users/Marco/Music/default.m3u"), "m3u");

    with

    QFile inputFile("C:/Users/Marco/Music/default.m3u"); if (inputFile.open(QIODevice::ReadOnly)) { QTextStream in(&inputFile); in.setCodec("UTF-8"); while (!in.atEnd()) { QString line = in.readLine().trimmed().toUtf8().constData(); playlist->addMedia(QUrl(QFileInfo(line).filePath())); } inputFile.close(); }

    and

    playlist->save(QUrl::fromLocalFile("C:/Users/Marco/Music/default.m3u"), "m3u");

    with

    QFile outputFile("C:/Users/Marco/Music/default.m3u"); outputFile.open(QIODevice::WriteOnly|QIODevice::Text); for (int i=0; i < playlist->mediaCount(); i++) { //… QTextStream out(&outputFile); out << mediafile[0].toUpper()+mediafile.mid(1) << endl; //… } outputFile.close();
  • 1 Votes
    15 Posts
    18k Views
    raven-worxR

    @Rohith
    instead of converting the unicode string to the escaped characters send it directly in binary form. When you have a QString already you can call QString::toUtf8() and send the returned QByteArray directly. On the client its enough to do QString::fromUtf8( receivedUtf8ByteArray.constData() )

    It depends how you implemented the transfer.
    But theoretically it should be enough to replace your unicode escaping code on the server with this approach.

  • 0 Votes
    4 Posts
    4k Views
    kshegunovK

    @Mark81
    Curious. What about:

    qDebug() << (QString::fromUtf8(value) == QStringLiteral("citt\u00E0"));

    Where value is the JSON value of that particular field (i.e. città).

    PS.
    What I'm trying to figure out is if this is an output issue, or encoding issue.

  • 0 Votes
    7 Posts
    2k Views
    0

    @SGaist That is true, thanks!

  • qDebug utf-8 issue

    Unsolved General and Desktop
    4
    0 Votes
    4 Posts
    2k Views
    jsulmJ

    Windows? That explains :-)
    I tested on Linux.
    I don't know how to fix this on Windows.
    Maybe this can help you: http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how

  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    4 Posts
    2k Views
    H

    If I'm not completely mistaken Qt 4.8 does not assume c-strings to be in UTF-8 by default,
    but instead assumes they are in the systems default encoding. Have you tried with:
    QString::fromUtf8("mystring");?

  • 0 Votes
    5 Posts
    2k Views
    Lays147L

    @SGaist Its using Serif. In the terminal there, when he run the app the follow error appears: Qt fontDatabase: cannot find font directory /home/user.../ . Is qt install correctly?
    I think the app is searching for a font in the folder of Qt. But if i make the app static, this font dont need be with the app? Well if i need to copy the font files, how to link to my app?

  • 0 Votes
    7 Posts
    5k Views
    SGaistS

    Good idea, voted !