Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. I want to get 3rd part softeware can decode music with no-ascll name such as chinese
Forum Updated to NodeBB v4.3 + New Features

I want to get 3rd part softeware can decode music with no-ascll name such as chinese

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
16 Posts 3 Posters 5.5k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #7

    Since you are passing the path to an external library you should call QDir::toNativeSperators use the result to pass the path to player->OpenFile

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    chaochaoC 1 Reply Last reply
    0
    • SGaistS SGaist

      Since you are passing the path to an external library you should call QDir::toNativeSperators use the result to pass the path to player->OpenFile

      chaochaoC Offline
      chaochaoC Offline
      chaochao
      wrote on last edited by
      #8

      @SGaist I did that ,but i got a same err. I think the problem is not this.Because when i pass the path like this C:\Users\Public\Music\Sample Music\Sleep Away.mp3 ,it will be ok.But when Sleep Away is replaced with chinese ,it will return err.

      JKSHJ 1 Reply Last reply
      0
      • chaochaoC chaochao

        @SGaist I did that ,but i got a same err. I think the problem is not this.Because when i pass the path like this C:\Users\Public\Music\Sample Music\Sleep Away.mp3 ,it will be ok.But when Sleep Away is replaced with chinese ,it will return err.

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #9

        @chaochao said in I want to get 3rd part softeware can decode music with no-ascll name such as chinese:

        when i pass the path like this C:\Users\Public\Music\Sample Music\Sleep Away.mp3 ,it will be ok.But when Sleep Away is replaced with chinese ,it will return err.

        What encoding is your filename? UTF-8, or EUC-CN, or GB18030, or something else?

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        chaochaoC 1 Reply Last reply
        1
        • JKSHJ JKSH

          @chaochao said in I want to get 3rd part softeware can decode music with no-ascll name such as chinese:

          when i pass the path like this C:\Users\Public\Music\Sample Music\Sleep Away.mp3 ,it will be ok.But when Sleep Away is replaced with chinese ,it will return err.

          What encoding is your filename? UTF-8, or EUC-CN, or GB18030, or something else?

          chaochaoC Offline
          chaochaoC Offline
          chaochao
          wrote on last edited by
          #10

          @JKSH filename get by QFileDialog::getOpenFileNames and convert to const char * by under code

            QByteArray ba  = filename.toUtf8();
            const char * name = ba.data();
          

          name will pass to OpenFile

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #11

            What @JKSH is asking is not what you are using to decode the filename but how it is encoded by your OS.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            chaochaoC 1 Reply Last reply
            0
            • SGaistS SGaist

              What @JKSH is asking is not what you are using to decode the filename but how it is encoded by your OS.

              chaochaoC Offline
              chaochaoC Offline
              chaochao
              wrote on last edited by
              #12

              @SGaist GBK2312

              JKSHJ 1 Reply Last reply
              0
              • chaochaoC chaochao

                @SGaist GBK2312

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by JKSH
                #13

                @chaochao said in I want to get 3rd part softeware can decode music with no-ascll name such as chinese:

                GBK2312

                If your filename is not encoded in UTF-8, that means toUtf8() will give you the wrong path.

                Try converting your filename to the GB2312, not UTF-8:

                QTextCodec* codec = QTextCodec::codecForName("GB2312");
                QByteArray ba = codec->fromUnicode(filename);
                const char* name = ba.data();
                

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                chaochaoC 1 Reply Last reply
                2
                • JKSHJ JKSH

                  @chaochao said in I want to get 3rd part softeware can decode music with no-ascll name such as chinese:

                  GBK2312

                  If your filename is not encoded in UTF-8, that means toUtf8() will give you the wrong path.

                  Try converting your filename to the GB2312, not UTF-8:

                  QTextCodec* codec = QTextCodec::codecForName("GB2312");
                  QByteArray ba = codec->fromUnicode(filename);
                  const char* name = ba.data();
                  
                  chaochaoC Offline
                  chaochaoC Offline
                  chaochao
                  wrote on last edited by
                  #14

                  @JKSH as your code ,if i qDebug()<<name;

                  it will output
                  C:/Users/Public/Music/Sample Music/????.mp3

                  JKSHJ 1 Reply Last reply
                  0
                  • chaochaoC chaochao

                    @JKSH as your code ,if i qDebug()<<name;

                    it will output
                    C:/Users/Public/Music/Sample Music/????.mp3

                    JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #15

                    @chaochao said in I want to get 3rd part softeware can decode music with no-ascll name such as chinese:

                    @JKSH as your code ,if i qDebug()<<name;

                    it will output
                    C:/Users/Public/Music/Sample Music/????.mp3

                    What do you see if you call qDebug() << ba?

                    Does zplay recognize this name?

                    What happens if you use Windows functions to get the filename? http://stackoverflow.com/questions/3176208/files-in-directory-in-c

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      Don't forget you still need to first convert the path to native separators before passing it to your other library.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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