Bug 389415 - Project Plugin: A folder with umlaut (ä) ist not shown in tree
Summary: Project Plugin: A folder with umlaut (ä) ist not shown in tree
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 17.12.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-25 15:42 UTC by Gregor Mi
Modified: 2018-02-25 12:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: KDE Applications 18.04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Mi 2018-01-25 15:42:08 UTC
When I add the folder "Der-Bäcker" with a file 'test' to my git repo, the file 'test' is listed under the <untracked> section. When I rename the folder to "Der-Baecker" it works fine. "Der-Böcker" also does not work. In this case even Ctrl+Alt+O does not find the file or folder.
Comment 1 Dominik Haumann 2018-01-26 16:12:20 UTC
Which encoding are you using in your system (LANG). Does it work, when you start kate with: LC_ALL=de_DE kate
(or was it LANG=de_DE kate ?)
Comment 2 Gregor Mi 2018-01-26 21:55:58 UTC
$ echo $LANG
de_DE.UTF-8
# LC_ALL does not exist.
$ export LC_ALL=de_DE
$ kate

Now the file in the "Der-Bäcker" folder is not even opened but "New file" is shown; even if I drag&drop the file from dolphin.

# Reset LC_ALL
$ export LANG=de_DE
$ kate

Same effect as above: "New file" instead of opening the file.

$ export LANG=de_DE.UTF-8
$ kate

At least the file is loaded to the editor.
Comment 3 Dominik Haumann 2018-02-04 21:14:56 UTC
The problem is that `git ls-files` outputs:

  $ git ls-files | grep Der
  "Der B\303\244cker/L\303\266ffler.txt"
  DerBaecker/Loeffler.txt

So this is wrapped in quotes, which is probably a parsing issue in Kate.
Comment 4 Dominik Haumann 2018-02-04 22:00:32 UTC
Possible fix: https://phabricator.kde.org/D10311
Comment 5 Dominik Haumann 2018-02-25 11:38:23 UTC
Git commit a59237913165c12cdeea53d2839618d780561464 by Dominik Haumann.
Committed on 25/02/2018 at 11:38.
Pushed by dhaumann into branch 'master'.

Projects plugin: fix git file listing for umlauts such as äöü

Summary:
git ls-files avoids umlauts or unicode surrogate characters.
The problem is that `git ls-files` outputs:

  $ git ls-files | grep Der
  "Der B\303\244cker/L\303\266ffler.txt"
  DerBaecker/Loeffler.txt

instead of "Der Bäcker\Löffler.txt".
It uses quotes and unicode escape sequences to avoid the ä and ö.

This patch uses `git ls-files -z` for listing the contents. Instead
of \r\n, the file listing the dumps a bytearray that is \0 separated
for each entry.

In the -z mode, no unicode escaping is done, and the umlauts such
as äöü or any other unicode characters are displayed correctly.

There is still room for improvement, since readAllStandardOutput()
might return a very large listing, which allocates a lot of memory.
Therefore, a buffered solution (using a lambda or so) would probably
be better. This, however, can be done in a separate patch.

Test Plan: make test

Reviewers: cullmann, gregormi, ngraham, brauch

Reviewed By: cullmann, brauch

Subscribers: brauch, #kate

Tags: #kate

Differential Revision: https://phabricator.kde.org/D10311

M  +8    -2    addons/project/kateprojectworker.cpp

https://commits.kde.org/kate/a59237913165c12cdeea53d2839618d780561464