Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-27238

The source code viewer does not respect the encoding of the file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 4.8.2, 5.0.1
    • Tools: Linguist
    • None
    • Qt 5: c4f1ac0fbcd452f440aee4a3304574cb7fbca0ce Qt 4.8: 6626e5f41712723405c110a4f11ad650116f7523

    Description

      The Linguist source code viewer does not respect the encoding of the file as it always loads it as latin1.

      tools/linguist/linguist/sourcecodeview.cpp:

      fileText = QString::fromLatin1(file.readAll());

      Steps to reproduce:

      The sourcefile is saved in UTF-8 and some unicode character is used, for example:

      setText(tr("variable χ"));

      Create translation file:

      lupdate example.pro -codecfortr UTF-8 -ts example.ts

      Open the file in Linguist

      linguist example.ts

      Result: Unicode character is not shown correctly

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mitch_curtis Mitch Curtis
            qtcomsupport Qt Support
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes