<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/110043/">http://git.reviewboard.kde.org/r/110043/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On May 7th, 2013, 10:11 a.m. UTC, <b>Róbert Szókovács</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The solution is intentionally "shy", I really don't want to fan the flames surrounding this issue. I just stumbled upon this location when it can be handled painlessly. Whether or not it should be turned on by default, in my opinion, can be left for distributors.</pre>
 </blockquote>




 <p>On May 7th, 2013, 10:45 a.m. UTC, <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Then it's worthless.

When I encounter broken filenames on a rw device, i know it's time for a fix.
When I encounter broken filenames in joliet or rockridge (latter usually caused by myself long ago - thank you, "wodim"...) i know it's time to mount norock/nojoliet.
Whether i do that or set a (KDE only affecting) env makes hardly a difference.

When my little sister™ encounters broken filenames anywhere, she knows that it's time to call her personal IT (me) with "these files won't open!" - if she could not call me, she had no access to those files. Period.
She won't think to google for "kde broken filenames", because she would not think it's a "problem with the name" - the files have weird names, yes, but essentially they won't open when she clicks them.
That this could be due to some restrictions in UTF-8 and QString and other terms she does not know, cannot be an expected consideration.

So either this is not a fixworthy issue at all, or it (as OPT-IN) only becomes a way for distro discrimination (works on distro X but not on distro Y) because fact is that the filenames are broken and if we want to assist in that situation, we assist the unskilled *only* and the unskilled simply dont set env vars. If they did, they were also skilled enough for convmv et al. to deal with that issue correctly.

IOW *every* distro but Arch/Gentoo/LFS - ie. where you read a wiki for setup - likely would *have* to set this anyway and those have the users to turn it off at will.

/2¢</pre>
 </blockquote>





 <p>On May 10th, 2013, 4:23 p.m. UTC, <b>Róbert Szókovács</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">OK, I'm all for making this on by default, but that would be a change from the current situation, when the default is QFile's filename encoding, basen on locale. If this becomes the default, it disrupts those who use a non-UTF8 locale. The current code provides an enviroment variable to force KDE to threat the filenames UTF8, this patch piggybacks that mechanism. Should we check the locale the same way QFile does?</pre>
 </blockquote>





 <p>On May 10th, 2013, 5:18 p.m. UTC, <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">There should be no regression in regular use on non broken FS names for no-one - not even those using non UTF-8 locales, so yes - testing the locale to dis/enable this sounds reasonable.

Is the solution as simple as deactivating it if the tested env is set to anything but "non_broken_names"?</pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">No, I'm affraid we would need heuristics similar to the one in QT, see qtextcodec.cpp, setupLocaleMapper(): "Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG environment variables.", then check the CODESET part; if it's UTF8, enable this new functionality, otherwise do as before the patch.</pre>
<br />










<p>- Róbert</p>


<br />
<p>On May 7th, 2013, 4:14 p.m. UTC, Róbert Szókovács wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for kdelibs and Thiago Macieira.</div>
<div>By Róbert Szókovács.</div>


<p style="color: grey;"><i>Updated May 7, 2013, 4:14 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This patch works around the problem of filenames that are not valid UTF8 strings:  in KLocalePrivate::initFileNameEncoding() KDE sets the QFile's encoding/decoding function, to to/fromUTF8() in QString, which in turn calls QUtf8's converter function (QUtf8 is not exported to developers, so I had to use an inefficient method, I think it would be better if we could use the state parameter for error detection). I replaced this with the said functions' copy/pasted version and changed it, so when it encounters an invalid UTF8 string, it will encode it byte by byte, mapping the lower 128 their normal unicode place and the upper 128 to U+18000-U+1807F, and of course the decoder reverses it. 
To make this actually work you have to define the KDE_UTF8_FILENAMES enviroment variable to a specific value ("broken_names").

To test it, do the following: .kde/env/KDE_UTF8_FILENAMES.sh with this content: 
export KDE_UTF8_FILENAMES=broken_names
logout, login, try dolphin on faulty files. (instead of the usual boxed "?" you'll see just boxes)</pre>
  </td>
 </tr>
</table>




<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=165044">165044</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kdecore/localization/klocale_kde.cpp <span style="color: grey">(b010e74)</span></li>

 <li>kdecore/localization/klocale_p.h <span style="color: grey">(af4a768)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/110043/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>