<div>Hi all once again,</div><div><br></div><div>I am using the Android 'Crystax' R5 SDK to use TagLib on Android:</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://www.crystax.net/android/ndk.php">http://www.crystax.net/android/ndk.php</a></div>
<div><br></div><div>which is still having some issues with wstring / wchar support:</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://www.crystax.net/trac/ticket/26">http://www.crystax.net/trac/ticket/26</a></div>
<div><br></div><div><br></div><div>Now in TagLib, in the file tstring.cpp, the wstring::erase() method is used, which is NO problem ofcourse with native Linux/Windows development and I guess any other platform for now, but with Crystax it fails to properly move all characters of the resulting string. The workaround I found, for now, is this:</div>
<div><br></div><div>...</div><div><div><font class="Apple-style-span" face="'courier new', monospace" size="1">void String::prepare(Type t)</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1">{</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"> switch(t) {</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"> case UTF16:</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"> {</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"> if(d->data.size() >= 1 && (d->data[0] == 0xfeff || d->data[0] == 0xfffe)) {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"> bool swap = d->data[0] != 0xfeff;</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"> </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"> // ORIGINAL TAGLIB CODE. ERASE FUNCTION RESPONSIBLE FOR DUPLICATE CHARACTER ON 6TH POSITION OF STRING USING CRYSTAX</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace" size="1"> //d->data.erase(d->data.begin(), d->data.begin() + 1);</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"> </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"> // FIX FOR CRYSTAX R5 SDK:</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"> for(uint i =0; i < d->data.size()-1; i++){</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"><span class="Apple-tab-span" style="white-space:pre">        </span>d->data[i] = d->data[i+1];</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"> } </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1"> d->data.resize(d->data.size()-1);</font></div></div><div>...</div><div><br></div><div>Note that I also could not use the 'wstring::copy()' method either, it produces the same bug...</div>
<div><br></div><div>Is there perhaps a way to implement this 'workaround' without having to change an internal class of TagLib, with which nothing is wrong? Because I wouldn't dare to ask to include this change in the official sourcecode, with precompiler directive or not, since it's not a bug of TagLib itself... or should I? ;)</div>
<div><br></div><div>Thanks for reading, hope to hear any thoughts,</div><div> Martijn van Rheenen</div><br>