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. UTF-8 encoded files doesn’t open in Qt creator 2.2 64-bit under Ubuntu
Forum Updated to NodeBB v4.3 + New Features

UTF-8 encoded files doesn’t open in Qt creator 2.2 64-bit under Ubuntu

Scheduled Pinned Locked Moved Qt Creator and other tools
12 Posts 4 Posters 21.2k 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.
  • W Offline
    W Offline
    winspear
    wrote on last edited by A Former User
    #1

    I have a cross platform project that I created in Qt Creator for Windows and now I am not able to open the cpp files which are UTF-8 encoded under Linux Qt creator. It keeps saying

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

    Good old VI editor is able to open it without problems. Even gEDit opens it fine.

    Any help will be appreciated.

    Thanks
    V

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      On the top right you should see an edit button/bar. When you click it you can select another encoding.

      But i don't know why this happens sometimes.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • W Offline
        W Offline
        winspear
        wrote on last edited by
        #3

        I tried all the encodings from the drop down menu. None of them works. :(

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          bq. I tried all the encodings from the drop down menu

          All of them? How many do you have? My list is huge.

          What locale are you using on linux? Maybe you could use something else in ubuntu?

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            That message says that the file is not encoded in utf-8 but something else. Cleaning up special characters will most likely help as will converting in from the right encoding.

            Where did you get creator from and which version is it?

            1 Reply Last reply
            0
            • W Offline
              W Offline
              winspear
              wrote on last edited by
              #6

              This is all the locale I have on my system. Should I update my encodings by installing something ?

              @LANG=en_US.UTF-8
              LANGUAGE=en_US:en
              LC_CTYPE="en_US.UTF-8"
              LC_NUMERIC="en_US.UTF-8"
              LC_TIME="en_US.UTF-8"
              LC_COLLATE="en_US.UTF-8"
              LC_MONETARY="en_US.UTF-8"
              LC_MESSAGES="en_US.UTF-8"
              LC_PAPER="en_US.UTF-8"
              LC_NAME="en_US.UTF-8"
              LC_ADDRESS="en_US.UTF-8"
              LC_TELEPHONE="en_US.UTF-8"
              LC_MEASUREMENT="en_US.UTF-8"
              LC_IDENTIFICATION="en_US.UTF-8"
              LC_ALL=
              @

              I downloaded 64-bit version of QT from here yesterday and I got the online installer. The install succeeded without errors.

              http://qt.nokia.com/downloads/

              Originally the cpp file was created using Visual studio 2005 under Windows.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Scylla
                wrote on last edited by
                #7

                I have already seen this before. This happens somtimes if the file was created on windows (7). What do in this case is, I'm using a editor (pspad) and convert (to utf-8) and save this file again. After this I can open this file without problems in QtCreator on my linux

                [Edit]
                This files were created original within QtCreator (2.1) on Windows 7 (64Bit), so it's strange.

                1 Reply Last reply
                0
                • EddyE Offline
                  EddyE Offline
                  Eddy
                  wrote on last edited by
                  #8

                  Thanks for the tip. Editing encoding in Qt Creator solved it for me but not forever. Sometimes i had to do it again. I will try it out when i get this error again., but it has been a while since i saw it.

                  My files were created using Qt Creator 2.1 on kubuntu 10.10 using the linux installer from the qt nokia website. When i open them on windows 7 64 bit with the qtsdk1.1 i got the same error as yours, but i could't reproduce it. That's why i didn't file a bug report.

                  Qt Certified Specialist
                  www.edalsolutions.be

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    winspear
                    wrote on last edited by
                    #9

                    Thanks Scylla. I finally ended up converting my files to UTF-8 using my Notepad++ application under Windows.
                    But I find it to be very unprofessional on part of QT Creator not being able to automatically recognize an encoded CPP file. For God's sake, it is supposed to be a C++ IDE.
                    Anyways, thanks for all your help.

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tobias.hunger
                      wrote on last edited by
                      #10

                      Qt Creator by default uses the system encoding to save files. On windows the system encoding is dependent on your language and rarely UTF-8.

                      So if you work in cross-platform team decide on one encoding and make sure everybody uses that. If you want to enforce the encoding for all files, you can use a commit hook on your VCS server. That works well, even if some developers want to use other editors.

                      String constants in C++ files are dependent on the encoding of the file! Encodings are not necessarily interchangeable either: Just think of having to compare strings from some server somewhere to stored strings. You do not want those to fail because the encoding is a bit different. Combine that with the fact that guessing at an encoding is just that: Guessing and you do not want Creator to do that for you.

                      1 Reply Last reply
                      0
                      • EddyE Offline
                        EddyE Offline
                        Eddy
                        wrote on last edited by
                        #11

                        Thanks Tobias,

                        That explains it very well!

                        Qt Certified Specialist
                        www.edalsolutions.be

                        1 Reply Last reply
                        0
                        • W Offline
                          W Offline
                          winspear
                          wrote on last edited by
                          #12

                          Thanks for the explanation Tobias.

                          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