Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator error could not decode with "UTF-8" Editing not possible.
Forum Updated to NodeBB v4.3 + New Features

QtCreator error could not decode with "UTF-8" Editing not possible.

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 4 Posters 8.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MarukoM Offline
    MarukoM Offline
    Maruko
    wrote on last edited by
    #1

    Hello,
    on Ubuntu 16.04 my QtCreator 4.7.2 complains when editing files with locale carachters "èéàòì" even if they are into comments.

    This is the error:

    Error: Could not decode "filename.cpp" with "UTF-8"-encoding. Editing not possible.
    

    How can I solve that?
    TIA

    jsulmJ 1 Reply Last reply
    0
    • MarukoM Maruko

      Hello,
      on Ubuntu 16.04 my QtCreator 4.7.2 complains when editing files with locale carachters "èéàòì" even if they are into comments.

      This is the error:

      Error: Could not decode "filename.cpp" with "UTF-8"-encoding. Editing not possible.
      

      How can I solve that?
      TIA

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Maruko Does the file contain valid UTF-8 text?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • MarukoM Offline
        MarukoM Offline
        Maruko
        wrote on last edited by
        #3

        @jsulm I don't know.
        I have this problem wen I edit a file with another editor (i.e. gedit) inserting characters like "èéàòùì".
        When I do the same directly in QtCreator I don't have such problem.

        aha_1980A 1 Reply Last reply
        0
        • MarukoM Maruko

          @jsulm I don't know.
          I have this problem wen I edit a file with another editor (i.e. gedit) inserting characters like "èéàòùì".
          When I do the same directly in QtCreator I don't have such problem.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Maruko

          You can run the command file filename.cpp to get more information about the encoding.

          Most likely the file was created on Windows and has Latin-1 encoding. However, Qt (and most modern compilers) requires sources files in UTF-8 encoding.

          Regards

          Qt has to stay free or it will die.

          1 Reply Last reply
          2
          • MarukoM Offline
            MarukoM Offline
            Maruko
            wrote on last edited by
            #5

            @aha_1980
            thank you for the hint!

            The files without problems are
            C source, ASCII text, with CRLF line terminators

            The files not editable are
            C source, ISO-8859 text, with CRLF line terminators

            What do you suggest to do to unify every file in the same right way?

            aha_1980A 1 Reply Last reply
            0
            • MarukoM Maruko

              @aha_1980
              thank you for the hint!

              The files without problems are
              C source, ASCII text, with CRLF line terminators

              The files not editable are
              C source, ISO-8859 text, with CRLF line terminators

              What do you suggest to do to unify every file in the same right way?

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi @Maruko,

              for encoding conversion in Linux this link gives a good overview. You can either convert it to UTF-8 (keeping all characters), or to pure ASCII, which means your characters will be replaced with the most similar ASCII character (e.g. é -> e).

              Please note, that CRLF line endings is also not the usual UNIX style, which can hurt you sooner or later.

              Git for example, let you checkout files on Windows with CRLF endings, while on Linux it gives only LF to maximise the interoperability.

              Qt has to stay free or it will die.

              1 Reply Last reply
              2
              • P Offline
                P Offline
                paulrpotts
                wrote on last edited by
                #7

                I just discovered this because a header file from FTDI contained a copyright symbol. I just converted that to read (C) instead of the copyright symbol and it was fine.

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved