[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglib-devel
Subject:    Re: Creating FileRef object from QString
From:       Plasty Grove <plasty.grove () gmail ! com>
Date:       2009-12-06 4:57:57
Message-ID: eb2963f20912052056i38053c9frbcb1806c1837d265 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks so much Michael. That's exactly what was needed, straight ASCII
conversion.

This is what works:

QString qstr = "/home/mydir/music/song.mp3";
TagLib::FileRef tagFile(qstr.toAscii());

Apologies, I didn't take note of the toAscii() function.

Regards,
Abhiram.


On Sun, Dec 6, 2009 at 2:59 AM, Michael Pyne <mpyne@purinchu.net> wrote:

> On Saturday 05 December 2009 15:25:13 Plasty Grove wrote:
> > That makes sense, but even the following doesn't work:
> >
> > QString qstr = "/home/mydir/music/song.mp3";
> > QByteArray qbArray = qstr.toLocal8Bit();
> > const char* str = qbArray.constData();
> > TagLib::FileRef tagFile(str);
> >
> > In this case, I've got a local object which stores the value returned by
> > toLocal8Bit() and which is in scope when I'm using str. Does qbArray get
> > destroyed whenever constData() is called on it? When I'm debugging, I can
> > still see str holding a value when it goes to the next step.
>
> Perhaps an encoding issue if you don't use straight US-ASCII for your file
> names? In that case if "local8Bit" is not the encoding Taglib is expecting
> you'll get weirdness.
>
> The KDE JuK music manager uses taglib and has TString/QString conversion
> code
> (and I'm sure Amarok has the same thing) if you want to see how those
> projects
> do it.
>
> If it's not encoding I'm not sure what to try other than stepping through
> FileRef in the debugger to see where the logic goes astray.
>
> Regards,
>  - Michael Pyne
>
> _______________________________________________
> taglib-devel mailing list
> taglib-devel@kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
>

[Attachment #5 (text/html)]

Thanks so much Michael. That&#39;s exactly what was needed, straight ASCII \
conversion.<br><br>This is what works:<br><br>QString qstr = \
&quot;/home/mydir/music/song.mp3&quot;;<br>TagLib::FileRef \
tagFile(qstr.toAscii());<br>

<br>Apologies, I didn&#39;t take note of the toAscii() \
function.<br><br>Regards,<br>Abhiram.<br> <br><br><div class="gmail_quote">On Sun, \
Dec 6, 2009 at 2:59 AM, Michael Pyne <span dir="ltr">&lt;<a \
href="mailto:mpyne@purinchu.net">mpyne@purinchu.net</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im">On Saturday 05 December 2009 15:25:13 Plasty Grove wrote:<br>
&gt; That makes sense, but even the following doesn&#39;t work:<br>
&gt;<br>
&gt; QString qstr = &quot;/home/mydir/music/song.mp3&quot;;<br>
&gt; QByteArray qbArray = qstr.toLocal8Bit();<br>
&gt; const char* str = qbArray.constData();<br>
&gt; TagLib::FileRef tagFile(str);<br>
&gt;<br>
&gt; In this case, I&#39;ve got a local object which stores the value returned by<br>
&gt; toLocal8Bit() and which is in scope when I&#39;m using str. Does qbArray get<br>
&gt; destroyed whenever constData() is called on it? When I&#39;m debugging, I \
can<br> &gt; still see str holding a value when it goes to the next step.<br>
<br>
</div>Perhaps an encoding issue if you don&#39;t use straight US-ASCII for your \
file<br> names? In that case if &quot;local8Bit&quot; is not the encoding Taglib is \
expecting<br> you&#39;ll get weirdness.<br>
<br>
The KDE JuK music manager uses taglib and has TString/QString conversion code<br>
(and I&#39;m sure Amarok has the same thing) if you want to see how those \
projects<br> do it.<br>
<br>
If it&#39;s not encoding I&#39;m not sure what to try other than stepping through<br>
FileRef in the debugger to see where the logic goes astray.<br>
<br>
Regards,<br>
<font color="#888888"> - Michael Pyne<br>
</font><br>_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org">taglib-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/taglib-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/taglib-devel</a><br> \
<br></blockquote></div><br>



_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic