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

QTextCodec::canEncode always returns true for codecForLocale() on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.1
    • None
    • Windows 10, en_US locale, experimental UTF-8 support not enabled
    • Windows

    Description

      QTextCodec::codecForLocale()->canEncode(string) seems to return `true` for any string I can give it, even those that it obviously fails to encode.

      This seems to work properly for every other codec I tried.

      I wouldn't be shocked if this impossible to handle correctly due to the way codecForLocale() has to be implemented on Windows, but if that's the case, it probably warrants a warning somewhere in the documentation.

      Attachments

        1. main.cpp
          1 kB
        2. system.png
          system.png
          5 kB
        3. windows-1252.png
          windows-1252.png
          5 kB
        4. latin-1.png
          latin-1.png
          7 kB
        5. utf-8.png
          utf-8.png
          6 kB

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              parkotron Parker Coates
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes