<p>Got a few more details:<br>
at first, this is a problem in grep.exe (at least this one distributed with Geany, maybe other/better binaries are out there):</p>

<p>if I run the grep command on the cmd.exe, I also get the <code>grep: ./??????: Invalid argument</code> result. But in your screenshot you got those squares.<br>
<a href="https://cloud.githubusercontent.com/assets/617017/11814977/ed323d42-a349-11e5-9ada-d11d0ead4202.png" target="_blank"><img src="https://cloud.githubusercontent.com/assets/617017/11814977/ed323d42-a349-11e5-9ada-d11d0ead4202.png" alt="win32_grep_unicode" style="max-width:100%;"></a></p>

<p>For futher testing, I created a directory with a German umlaut (<code>lalelö</code>).<br>
Result in cmd.exe:<br>
<a href="https://cloud.githubusercontent.com/assets/617017/11814994/022d542a-a34a-11e5-9b6e-ebcf2d4b72b1.png" target="_blank"><img src="https://cloud.githubusercontent.com/assets/617017/11814994/022d542a-a34a-11e5-9b6e-ebcf2d4b72b1.png" alt="win32_grep_mixed_cmd" style="max-width:100%;"></a></p>

<p>Result in Geany:<br>
<a href="https://cloud.githubusercontent.com/assets/617017/11814996/074105e2-a34a-11e5-8bc6-e7ce3568c3a7.png" target="_blank"><img src="https://cloud.githubusercontent.com/assets/617017/11814996/074105e2-a34a-11e5-8bc6-e7ce3568c3a7.png" alt="win32_grep_mixed_geany" style="max-width:100%;"></a></p>

<p>cmd.exe displays the folder name <code>lalelö</code> correctly but is not able to display correctly the UTF-8 encoded search result.</p>

<p>In Geany, the result is vice-versa: the folder name is displayed incorrectly but the UTF-8 parts are displayed properly.</p>

<p>So, related to <a href="https://github.com/geany/geany/issues/784" class="issue-link" title='On Windows cannot execute grep tool "grep" if target path contain non ascii folder name'>#784</a>, we probably need to convert the output from external commands back from UTF-16 to UTF-8. Though I doubt whether this can ever work properly if in the same output there is also UTF-8 encoded text. At least I have no idea how this could work.</p>

<p>For curiosity, I just tested grep.exe from the MSYS2 environment:<br>
<a href="https://cloud.githubusercontent.com/assets/617017/11816518/041f3e2c-a351-11e5-8aa3-c34405843ea6.png" target="_blank"><img src="https://cloud.githubusercontent.com/assets/617017/11816518/041f3e2c-a351-11e5-8aa3-c34405843ea6.png" alt="win32_msys2_grep_mixed_geany" style="max-width:100%;"></a></p>

<p>So yeah, MSYS2 grep.exe seems to work nicely with Geany.<br>
<a href="https://github.com/NTMan" class="user-mention">@NTMan</a> it would be cool if you could test the grep.exe in the archive at <a href="http://repo.msys2.org/msys/x86_64/grep-2.22-1-x86_64.pkg.tar.xz">http://repo.msys2.org/msys/x86_64/grep-2.22-1-x86_64.pkg.tar.xz</a>. This is exactly the same as I used for the last test (verified with md5sum). I'm not sure whether this binary is supposed to work without a MSYS2 environment and I cannot test this.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany/issues/783#issuecomment-164819917">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ1XtL57vpqApoJYySWcyknHc_vCzks5pQDiIgaJpZM4GrMZ5.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/issues/783#issuecomment-164819917"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>