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

The documentation for QString::fromWCharArray() should be updated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.4.0 Alpha
    • 5.1.1
    • None
    • Windows 7 (32-bit)

    Description

      The documentation for QString::fromWCharArray() says: "If wchar is 4 bytes, the string is interpreted as ucs-4, if wchar is 2 bytes it is interpreted as ucs-2."

      The documentation for QString::fromStdWString() says: "The given string is assumed to be encoded in utf16 if the size of wchar_t is 2 bytes (e.g. on windows) and ucs4 if the size of wchar_t is 4 bytes (most Unix systems)."

      Since both functions do the same, the documentation should say the same. The documentation for QString::fromWCharArray() is misleading since UCS-2 does not support surrogate characters.

      Furthermore, both QString::fromWCharArray() and QString::fromStdWString() calls QString::fromUtf16(). The documentation for QString::fromUtf16() says that it checks for a byte order mark and that it's slow. The documentation for QString::fromWCharArray() and QString::fromStdWString() fails to mention this.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            stian Stian Andre Olsen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes