uutils / uutils/coreutils

`ls` produce bad output in Windows PowerShell if file name contains non-ASCII characters

Open
#11,103 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P - Windows U - ls
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

In a directory with files containing non-ASCII characters in file name:

PS ~\dir> Get-ChildItem | Select-Object Name

Name
----
文件1
fílè₂
файл3

GNU ls through bash gives:

PS ~\dir> bash -c ls
fílè₂  файл3  文件1

While uutils' ls gives lots of escapes (or ? if -N/--literal is used):

PS ~\dir> coreutils.exe -V
coreutils 0.6.0 (multi-call binary)
PS ~\dir> coreutils.exe ls
'f'$'\303\255''l'$'\303\250\342\202\202'  ''$'\346\226\207\344\273\266''1'
''$'\321\204\320\260\320\271\320\273''3'
PS ~\dir> coreutils.exe ls -N
f??l?????  ????????3  ??????1

Running uu-ls on Linux seems fine:

$ ls
fílè₂  файл3  文件1
$ uu-ls
fílè₂  файл3  文件1

Is it a issue with UTF-8 encoding? It seems that the numbers of ?'s are equal to the character's UTF-8 byte length.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the uu-ls and coreutils.exe ls examples in Windows PowerShell with the listed non-ASCII filenames, then compare them with GNU ls and the Linux behavior. Trace the uu-ls entry point and its Windows output or encoding handling; done means filenames are displayed correctly without escapes or replacement characters, including with -N/--literal.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.