<div dir="ltr">Just for posterity, a more general approach for converting NSString * or CFStringRef to a TagLib::String is posted below.  It could be made more efficient with a stack buffer of a fixed size and iterative conversion but this works well enough.<div>
<br></div><div><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);line-height:18px"><div class="" id="LC35" style="padding-left:10px">
<span class="" style>TagLib</span><span class="" style="font-weight:bold">::</span><span class="" style>String</span>  <span class="" style>TagLib</span><span class="" style="font-weight:bold">::</span><span class="" style>StringFromCFString</span><span class="" style>(</span><span class="" style>CFStringRef</span> <span class="" style>s</span><span class="" style>)</span></div>
<div class="" id="LC36" style="padding-left:10px"><span class="" style>{</span></div><div class="" id="LC37" style="padding-left:10px">     <span class="" style="font-weight:bold">if</span><span class="" style>(</span><span class="" style>nullptr</span> <span class="" style="font-weight:bold">==</span> <span class="" style>s</span><span class="" style>)</span></div>
<div class="" id="LC38" style="padding-left:10px">          <span class="" style="font-weight:bold">return</span> <span class="" style>String</span><span class="" style="font-weight:bold">::</span><span class="" style>null</span><span class="" style>;</span></div>
<div class="" id="LC39" style="padding-left:10px"><br style></div><div class="" id="LC40" style="padding-left:10px">        <span class="" style>CFRange</span> <span class="" style>range</span> <span class="" style="font-weight:bold">=</span> <span class="" style>CFRangeMake</span><span class="" style>(</span><span class="" style="color:rgb(0,153,153)">0</span><span class="" style>,</span> <span class="" style>CFStringGetLength</span><span class="" style>(</span><span class="" style>s</span><span class="" style>));</span></div>
<div class="" id="LC41" style="padding-left:10px">  <span class="" style>CFIndex</span> <span class="" style>count</span><span class="" style>;</span></div><div class="" id="LC42" style="padding-left:10px"><br style></div>
<div class="" id="LC43" style="padding-left:10px">  <span class="" style="color:rgb(153,153,136);font-style:italic">// Determine the length of the string in UTF-8</span></div><div class="" id="LC44" style="padding-left:10px">
        <span class="" style>CFStringGetBytes</span><span class="" style>(</span><span class="" style>s</span><span class="" style>,</span> <span class="" style>range</span><span class="" style>,</span> <span class="" style>kCFStringEncodingUTF8</span><span class="" style>,</span> <span class="" style="color:rgb(0,153,153)">0</span><span class="" style>,</span> <span class="" style="color:rgb(0,134,179)">false</span><span class="" style>,</span> <span class="" style>nullptr</span><span class="" style>,</span> <span class="" style="color:rgb(0,153,153)">0</span><span class="" style>,</span> <span class="" style="font-weight:bold">&</span><span class="" style>count</span><span class="" style>);</span></div>
<div class="" id="LC45" style="padding-left:10px"><br style></div><div class="" id="LC46" style="padding-left:10px">        <span class="" style="color:rgb(68,85,136);font-weight:bold">char</span> <span class="" style="font-weight:bold">*</span><span class="" style>buf</span> <span class="" style="font-weight:bold">=</span> <span class="" style="font-weight:bold">new</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">char</span> <span class="" style>[</span><span class="" style>count</span> <span class="" style="font-weight:bold">+</span> <span class="" style="color:rgb(0,153,153)">1</span><span class="" style>];</span></div>
<div class="" id="LC47" style="padding-left:10px"><br style></div><div class="" id="LC48" style="padding-left:10px">        <span class="" style="color:rgb(153,153,136);font-style:italic">// Convert it</span></div><div class="" id="LC49" style="padding-left:10px">
        <span class="" style>CFIndex</span> <span class="" style>used</span><span class="" style>;</span></div><div class="" id="LC50" style="padding-left:10px">   <span class="" style>CFIndex</span> <span class="" style>converted</span> <span class="" style="font-weight:bold">=</span> <span class="" style>CFStringGetBytes</span><span class="" style>(</span><span class="" style>s</span><span class="" style>,</span> <span class="" style>range</span><span class="" style>,</span> <span class="" style>kCFStringEncodingUTF8</span><span class="" style>,</span> <span class="" style="color:rgb(0,153,153)">0</span><span class="" style>,</span> <span class="" style="color:rgb(0,134,179)">false</span><span class="" style>,</span> <span class="" style>(</span><span class="" style>UInt8</span> <span class="" style="font-weight:bold">*</span><span class="" style>)</span><span class="" style>buf</span><span class="" style>,</span> <span class="" style>count</span><span class="" style>,</span> <span class="" style="font-weight:bold">&</span><span class="" style>used</span><span class="" style>);</span></div>
<div class="" id="LC51" style="padding-left:10px"><br style></div><div class="" id="LC52" style="padding-left:10px">        <span class="" style="font-weight:bold">if</span><span class="" style>(</span><span class="" style>CFStringGetLength</span><span class="" style>(</span><span class="" style>s</span><span class="" style>)</span> <span class="" style="font-weight:bold">!=</span> <span class="" style>converted</span><span class="" style>)</span></div>
<div class="" id="LC53" style="padding-left:10px">          <span class="" style>;</span></div><div class="" id="LC54" style="padding-left:10px"><br style></div><div class="" id="LC55" style="padding-left:10px"> <span class="" style="color:rgb(153,153,136);font-style:italic">// Add terminator</span></div>
<div class="" id="LC56" style="padding-left:10px">  <span class="" style>buf</span><span class="" style>[</span><span class="" style>used</span><span class="" style>]</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(221,17,68)">'\0'</span><span class="" style>;</span></div>
<div class="" id="LC57" style="padding-left:10px"><br style></div><div class="" id="LC58" style="padding-left:10px">        <span class="" style>String</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">result</span><span class="" style>(</span><span class="" style>buf</span><span class="" style>,</span> <span class="" style>String</span><span class="" style="font-weight:bold">::</span><span class="" style>UTF8</span><span class="" style>);</span></div>
<div class="" id="LC59" style="padding-left:10px"><br style></div><div class="" id="LC60" style="padding-left:10px">        <span class="" style="font-weight:bold">delete</span> <span class="" style>[]</span> <span class="" style>buf</span><span class="" style>;</span></div>
<div class="" id="LC61" style="padding-left:10px"><br style></div><div class="" id="LC62" style="padding-left:10px">        <span class="" style="font-weight:bold">return</span> <span class="" style>result</span><span class="" style>;</span></div>
<div class="" id="LC63" style="padding-left:10px"><span class="" style>}</span></div></pre></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 24, 2014 at 10:57 PM, Anand <span dir="ltr"><<a href="mailto:flashanand@gmail.com" target="_blank">flashanand@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Found the correct syntax - Thanks Patrick<br><br>        tag->itemListMap()["\251nam"] = TagLib::StringList(TagLib::String([@"ஜில்லுனு ஒரு காதல்" cStringUsingEncoding:NSUTF8StringEncoding],TagLib::String::UTF8));<br>

</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 23, 2014 at 8:26 AM, Anand <span dir="ltr"><<a href="mailto:flashanand@gmail.com" target="_blank">flashanand@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br></div><br>I think the syntax is wrong for obj-c.<br><br></div>But i think we are in right direction.<br>

<br>Thanks<span><font color="#888888"><br>Anand<br><div><br><br></div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Mar 23, 2014 at 5:01 AM, patrick machielse <span dir="ltr"><<a href="mailto:patrick@hieper.nl" target="_blank">patrick@hieper.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Op 22 mrt. 2014, om 17:05 heeft Anand <<a href="mailto:flashanand@gmail.com" target="_blank">flashanand@gmail.com</a>> het volgende geschreven:<br>
<div><br>
> I am trying to tag the title of an .m4v using TagLib like this<br>
><br>
> tag->itemListMap()["\251nam"] = TagLib::StringList([@“Bolt” cStringUsingEncoding:NSUTF8StringEncoding]);<br>
><br>
> It works because “Bolt” is in English. But the following doesn’t work - since it is in different language - any body knows why?<br>
><br>
> tag->itemListMap()["\251nam"] = TagLib::StringList([@“ஜில்லுனு ஒரு காதல்” cStringUsingEncoding:NSUTF8StringEncoding]);<br>
<br>
</div>I think you need to specify the encoding when you create the String / StringList:<br>
<br>
For instance:<br>
<br>
mp4tag->setTitle(String([@"ஜில்லுனு ஒரு காதல்" UTF8String], String::UTF8));<br>
<br>
constructors without a specific encoding Type assume Latin1.<br>
<br>
p.<br>
--<br>
Patrick Machielse<br>
Hieper Software<br>
<br>
<a href="http://www.hieper.nl" target="_blank">http://www.hieper.nl</a><br>
<a href="mailto:info@hieper.nl" target="_blank">info@hieper.nl</a><br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><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></div>