Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error Message - Could Not Decode [Solved]
Forum Updated to NodeBB v4.3 + New Features

Error Message - Could Not Decode [Solved]

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 16.0k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    PSI-lbc
    wrote on last edited by
    #1

    Using QTCreator..4.7.2

    Basically copied source from a QT dev environment on Win7 to a Mac.

    What does the following mean? The error displays above the QT Creator source code window when trying to open a specific .cpp file.

    @
    Could Not Decode "filename.cpp" with "System"-encoding. Editing not possible.@

    All other source modules can be edited. Just not this one. The really curious thing is that the "filename.ui" file can be edited...just the source gives the error.

    What does the error mean and how do I correct?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      perhaps you encoded it in some special codepage from windows? does it contain some special chars, which are not ASCII 7-bit?

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • P Offline
        P Offline
        PSI-lbc
        wrote on last edited by
        #3

        perhaps you encoded it in some special codepage from windows

        Not that I'm aware of. All the source files were created with QT Creator. I copied the entire project directory from the Win dev system, to a memory stick, and then to the Mac.

        Is it possible that one of the QT generated files( .o ui_ or moc ) is causing the issue?

        I did do a "Clean All" and a "Clean Project". I would have thought a QT generated files would have been deleted by doing so.

        Kinda stumped.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          .o files are not opened by Creator. The autogenerated ui_xx and moc_xxx files are quite platform independent.

          It's quite likely that filename.cpp is saved with a windows specific encoding, but not in a platform independent encoding like utf-8.

          To check, open the preferences in Qt Creator, go to "Text Editor", then to tab "behavior" and look for the default encoding.

          If the error message appears again, you should be presented with the option to choose a different encoding to load the file with. Choose the one, that's used on windows (most probably windows-1252/CP1252).

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          1
          • P Offline
            P Offline
            PSI-lbc
            wrote on last edited by
            #5

            Volker,

            Thanks. Checked the “Text Editor>Behavior” tab, but on the Creator version I'm using on Win7, there's actually an "Environment" top level option that has the "Default File Encoding" selection combo.

            I currently have it set to "System"..assuming that would be a generic option that would work on both Windows and Mac. Which it did for all files in the project except 1. That one file throws the error in the origianl post. Odd.

            Unfortunately, on the Mac, when the error is displayed, no option to change the encoding is offered..just the error message.

            Is there another encoding setting that would work on both Windows and Macs? You mentioned UTF-8..

            There is also a "ui_filename.h" file that appears to be a generated .h supplied by Creator. Is it possible that the encoding error is in the .h file that is included by the .ccp throwing the error?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Can you provide the file somewhere, download would be best, as pasting it here in the forums will destroy the original encoding.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • P Offline
                P Offline
                PSI-lbc
                wrote on last edited by
                #7

                Volker,

                The suggestion..

                bq.
                If the error message appears again, you should be presented with the option to choose a different encoding to load the file with. Choose the one, that’s used on windows (most probably windows-1252/CP1252)

                ...worked.

                I didn't see the "option button" at the far right of the error message. The button was/is the same color as the message bar and it blended in.

                I opend the dialog by clicking the button and after selecting a couple format options that did not have a effect, the one for "mac..." fixed the file having the problem.

                Still not sure why only 1 .cpp file in the project had a problem, but at this point problem is solved.

                Thanks.

                1 Reply Last reply
                1
                • M Offline
                  M Offline
                  mlong
                  wrote on last edited by
                  #8

                  Be sure and edit the post title to add [Solved].

                  Software Engineer
                  My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                  1 Reply Last reply
                  0

                  • Login

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