https://bugs.kde.org/show_bug.cgi?id=384321

            Bug ID: 384321
           Summary: Mess with encoding in kpmcore
           Product: partitionmanager
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: andr...@stikonas.eu
          Reporter: pali.ro...@gmail.com
  Target Milestone: ---

Created attachment 107670
  --> https://bugs.kde.org/attachment.cgi?id=107670&action=edit
$ git grep -E 'Latin1|Utf8'

Look at attched output from command: git grep -E 'Latin1|Utf8'

There is a big mess with encodings, on some places is used Latin1 on other
places UTF-8 without reason.

For converting filename stored in char* to QString should be used function
QFile::decodeName(). And for reverse operation -- conversion of filename from
QString to char* should be used function QFile::encodeName()

http://doc.qt.io/qt-5/qfile.html#decodeName
http://doc.qt.io/qt-5/qfile.html#encodeName

For converting other locale/system dependent settings (like env variables,
command line arguments or stdin/stdout), QString methods toLocal8Bit() and
fromLocal8Bit() should be used.

http://doc.qt.io/qt-5/qstring.html#toLocal8Bit
http://doc.qt.io/qt-5/qstring.html#fromLocal8Bit

Methods toUtf8() resp. toLatin1() should be used only in case callee C function
has defined API that char* must be in UTF-8 resp. in Latin1.

For ASCII strings, both UTF-8 and Latin1 encoding doing exaclty same things.
But problem happen for non-ASCII strings, when Unicode internationalization is
widely used. Properly written Unicode applications should not have this
problem.

Please recheck where UTF-8 resp. Latin1 functions are correctly used and where
decodeName() and fromLocal8Bit() should be instead.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to