taglib-devel Digest, Vol 114, Issue 1

Modoran George modoran.george at gmail.com
Tue Dec 3 17:52:54 UTC 2013


Why not use GetCommandLineW() and CommandLineToArgvW() on windows?

wmain is NOT implemented if you use MinGW.


2013/12/3 <taglib-devel-request at kde.org>

> Send taglib-devel mailing list submissions to
>         taglib-devel at kde.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.kde.org/mailman/listinfo/taglib-devel
> or, via email, send a message with subject or body 'help' to
>         taglib-devel-request at kde.org
>
> You can reach the person managing the list at
>         taglib-devel-owner at kde.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of taglib-devel digest..."
>
>
> Today's Topics:
>
>    1. TagLib::FileRef and Unicode (Jeremy Gregorio)
>    2. Re: TagLib::FileRef and Unicode (Tsuda Kageyu)
>    3. Re: TagLib::FileRef and Unicode (Miyakoda Akira)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 2 Dec 2013 06:42:33 -0700
> From: Jeremy Gregorio <jeremy.firefox.addon at gmail.com>
> To: taglib-devel at kde.org
> Subject: TagLib::FileRef and Unicode
> Message-ID:
>         <
> CAH2Gu2Ggtz5U7GTg7+W+nJdEvuVw01VX66rbhAwH-zbTn4M5wg at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>       I finally noticed my little tagging program doesn't handle Unicode in
> the slightest :).
>
>       Does anyone have suggestions on handling Unicode files?
>
>       I'm on an English (United States) Windows XP install trying to build
> with Visual C++.
>
>       To deal with the headache that is passing Unicode Parameters I use
> URI Encoding (like here http://meyerweb.com/eric/tools/dencoder/) to
> encode
> the parameters to a command line program I wrote and then decode them as
> they come in. This part seems to work since I can decode the strings and
> write them to tags with the Unicode intact.
>
>       But when I try to write tags to a file on a Unicode path it fails :(.
> Right no I'm using QT's library to handle the strings because of a
> stackoverflow post I found where the guy had good luck with it, but darned
> if I can get it working.
>
> int main(int argc, char *argv[])
> {
>
>     TagLib::List<TagLib::FileRef> fileList;
>
>     std::string fileName( "c:\\temp\\debug " );
>     std::string extension (".txt");
>     ofstream a_file ( fileName + extension );
>
>     QString filepath ( argv[argc - 1] );
>
>     QString url = QUrl::fromPercentEncoding( filepath.toUtf8() );
>
>     a_file << "Param: " << url.toStdString()  << "\n\n";
>
>     QFile myQfile ( url );
>
>     if( !myQfile.exists() ){
>         a_file << "The param \""  << myQfile.error() << "\" is not a
> file.";
>     }//END IF
>
>     TagLib::FileRef f( QFile::encodeName(url).constData() );
>
>     if(!f.isNull() && f.tag())
>       fileList.append(f);
>
>     argc--;
>
>   a_file.close();
>
>   //... If I get this far I can start applying tags.
>
>  The above works great until I try it with a unicode path, like
>
> "C:\temp\?\Power Up!.mp3"
>
> which I encode as
>
> C%3A%5Ctemp%5C%E7%A7%81%5CPower%20Up!.mp3
>
> I know I'm at least getting the string decoded right since I write it to a
> text file and it looks right in notepad++ encoded in UTF-8 without the BOM.
>
>
> --
> Jeremy D Gregorio
>
> <http://www.linkedin.com/pub/jeremy-gregorio/36/302/429>
> <http://www.glimmersoft.com/socialmedia/btn_viewmy_160x33.png>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.kde.org/pipermail/taglib-devel/attachments/20131202/1d437d55/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Tue, 03 Dec 2013 09:06:36 +0900
> From: Tsuda Kageyu <tsuda.kageyu at gmail.com>
> To: taglib-devel at kde.org
> Subject: Re: TagLib::FileRef and Unicode
> Message-ID: <6CEEFBB882863tsuda.kageyu at gmail.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi Jeremy.
>
> How about using wmain() instead of main()?
> main() is not suitable for arguments in Unicode. It converts the arguments
> into your local encoding irreversibly.
>
> This may help you:
>
> int wmain(int argc, wchar_t *argv[])
> {
> ...
>     QString filepath = QString::fromWCharArray( argv[argc - 1] );
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 3 Dec 2013 09:16:33 +0900
> From: Miyakoda Akira <tsuda.kageyu at gmail.com>
> To: "taglib-devel at kde.org" <taglib-devel at kde.org>
> Subject: Re: TagLib::FileRef and Unicode
> Message-ID:
>         <
> CAG4hMGekwX8Px+5hKiYNw-uUZ7xmkTtveQyzuBGgnq1LrTcubg at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Oh Jeremy! I forgot to tell you a thing.
>
> You should create a FileRef from a Unicode file name like this:
>
> int wmain(int argc, wchar_t *argv[])
> {
> ...
>     QString filepath = QString::fromWCharArray( argv[argc - 1] );
> ...
>     TagLib::FileRef f( filepath.toStdWString().cstr() );
>
>
> 2013/12/2 Jeremy Gregorio <jeremy.firefox.addon at gmail.com>
>
> > Hi all,
> >       I finally noticed my little tagging program doesn't handle Unicode
> > in the slightest :).
> >
> >       Does anyone have suggestions on handling Unicode files?
> >
> >       I'm on an English (United States) Windows XP install trying to
> build
> > with Visual C++.
> >
> >       To deal with the headache that is passing Unicode Parameters I use
> > URI Encoding (like here http://meyerweb.com/eric/tools/dencoder/) to
> > encode the parameters to a command line program I wrote and then decode
> > them as they come in. This part seems to work since I can decode the
> > strings and write them to tags with the Unicode intact.
> >
> >       But when I try to write tags to a file on a Unicode path it fails
> > :(. Right no I'm using QT's library to handle the strings because of a
> > stackoverflow post I found where the guy had good luck with it, but
> darned
> > if I can get it working.
> >
> > int main(int argc, char *argv[])
> > {
> >
> >     TagLib::List<TagLib::FileRef> fileList;
> >
> >     std::string fileName( "c:\\temp\\debug " );
> >     std::string extension (".txt");
> >     ofstream a_file ( fileName + extension );
> >
> >     QString filepath ( argv[argc - 1] );
> >
> >     QString url = QUrl::fromPercentEncoding( filepath.toUtf8() );
> >
> >     a_file << "Param: " << url.toStdString()  << "\n\n";
> >
> >     QFile myQfile ( url );
> >
> >     if( !myQfile.exists() ){
> >         a_file << "The param \""  << myQfile.error() << "\" is not a
> > file.";
> >     }//END IF
> >
> >     TagLib::FileRef f( QFile::encodeName(url).constData() );
> >
> >     if(!f.isNull() && f.tag())
> >       fileList.append(f);
> >
> >     argc--;
> >
> >   a_file.close();
> >
> >   //... If I get this far I can start applying tags.
> >
> >  The above works great until I try it with a unicode path, like
> >
> > "C:\temp\?\Power Up!.mp3"
> >
> > which I encode as
> >
> > C%3A%5Ctemp%5C%E7%A7%81%5CPower%20Up!.mp3
> >
> > I know I'm at least getting the string decoded right since I write it to
> a
> > text file and it looks right in notepad++ encoded in UTF-8 without the
> BOM.
> >
> >
> > --
> > Jeremy D Gregorio
> >
> > <http://www.linkedin.com/pub/jeremy-gregorio/36/302/429>
> > <http://www.glimmersoft.com/socialmedia/btn_viewmy_160x33.png>
> >
> > _______________________________________________
> > taglib-devel mailing list
> > taglib-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/taglib-devel
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.kde.org/pipermail/taglib-devel/attachments/20131203/ebf46811/attachment-0001.html
> >
>
> ------------------------------
>
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
>
> End of taglib-devel Digest, Vol 114, Issue 1
> ********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20131203/decea1b7/attachment.html>


More information about the taglib-devel mailing list