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. How to convert german umlaut characters to corresponding English characters ?

How to convert german umlaut characters to corresponding English characters ?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.6k 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.
  • Q Offline
    Q Offline
    QtVik
    wrote on last edited by
    #1

    Currently I am facing an issue with the file names containing german umlaut characters.
    Example:
    If the folder name has “lücke” it doesn't work.
    Need to be converted to “luecke”.

    How to convert umlaut characters to English ?

    Thanks in advance.

    jsulmJ 1 Reply Last reply
    0
    • Q QtVik

      Currently I am facing an issue with the file names containing german umlaut characters.
      Example:
      If the folder name has “lücke” it doesn't work.
      Need to be converted to “luecke”.

      How to convert umlaut characters to English ?

      Thanks in advance.

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

      @QtVik said in How to convert german umlaut characters to corresponding English characters ?:

      it doesn't work

      What doesn't work?

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

      Q 1 Reply Last reply
      0
      • jsulmJ jsulm

        @QtVik said in How to convert german umlaut characters to corresponding English characters ?:

        it doesn't work

        What doesn't work?

        Q Offline
        Q Offline
        QtVik
        wrote on last edited by
        #3

        @jsulm Say if you have this umlaut character in the file name then that file doesn't open.

        jsulmJ 1 Reply Last reply
        0
        • Q QtVik

          @jsulm Say if you have this umlaut character in the file name then that file doesn't open.

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

          @QtVik Can you show your code where you try to open the file? It should work.
          Replacing some characters in the file path with others will for sure not solve your problem as the file path will be invalid.
          You're most probably doing something wrong in your code.

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

          Q 1 Reply Last reply
          2
          • jsulmJ jsulm

            @QtVik Can you show your code where you try to open the file? It should work.
            Replacing some characters in the file path with others will for sure not solve your problem as the file path will be invalid.
            You're most probably doing something wrong in your code.

            Q Offline
            Q Offline
            QtVik
            wrote on last edited by
            #5

            @jsulm
            I have a method openDataReader which takes the file index and the file name as cstring as shown below:
            openDataReader(&m_DataFile[fileIndex], fileName.toStdString().c_str() )

            Does passing file name as cstring here is causing any problem ?

            jsulmJ VRoninV 2 Replies Last reply
            0
            • Q QtVik

              @jsulm
              I have a method openDataReader which takes the file index and the file name as cstring as shown below:
              openDataReader(&m_DataFile[fileIndex], fileName.toStdString().c_str() )

              Does passing file name as cstring here is causing any problem ?

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

              @QtVik You should rather use http://doc.qt.io/qt-5/qstring.html#toLocal8Bit
              And why do you need std::string? You don't use QFile?

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

              Q 1 Reply Last reply
              3
              • Q QtVik

                @jsulm
                I have a method openDataReader which takes the file index and the file name as cstring as shown below:
                openDataReader(&m_DataFile[fileIndex], fileName.toStdString().c_str() )

                Does passing file name as cstring here is causing any problem ?

                VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                @QtVik said in How to convert german umlaut characters to corresponding English characters ?:

                I have a method openDataReader which takes the file index and the file name as cstring as shown below:

                https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                5
                • jsulmJ jsulm

                  @QtVik You should rather use http://doc.qt.io/qt-5/qstring.html#toLocal8Bit
                  And why do you need std::string? You don't use QFile?

                  Q Offline
                  Q Offline
                  QtVik
                  wrote on last edited by
                  #8

                  @jsulm The openDataReader() is a library method which accepts file name as cstring .
                  The filename in a local function where it is called i am using QFile to check if the file exists.
                  Hence using toStdString().c_str().

                  However converting toLocal8Bit worked !! Thank you so much for your input.

                  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