Skip to content

Redirected Cyrillic output is messed up #2922

Open
@FallenGameR

Description

@FallenGameR
  • I have read through the manual page (man fzf)

  • I have searched through the existing issues

  • I have the latest version of fzf: 0.32.1 (4993d19)

  • OS: Windows

  • Shell: pswh 7.2.5 on Windows Terminal

Problem / Steps to reproduce

When fzf is invoked to select something Cyrillic non-redirected output is displayed correctly but redirected output captures something that can not be used as a string.

# displays valid text in the shell
"Алиса" | fzf
Алиса

# displays garbage, if redirected not to a variable but to a file - the same result
$a = "Алиса" | fzf
$a
Алиса

Here is what bat -A shows for the captured string:

» $a | bat -A
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ STDIN
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ \u{2568}\u{c9}\u{2568}\u{2557}\u{2568}\u{2555}\u{2564}\u{fc}\u{2568}\u{2591}<U+240D><U+240A>
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

And here is the UTF-8 encoding of the same string:

([System.Text.Encoding]::UTF8.GetBytes("Алиса") | %{ $_.ToString("X") }) -join " "
D0 90 D0 BB D0 B8 D1 81 D0 B0

I'm not event sure what encoding fzf is using in this case. Here is the encoded "A" letter. No bytes are matched whatsoever.

A

fzf
0x25 = 0010 0101
0x68 = 0110 1000
0xC9 = 1100 1001

UTF8
0xD0 = 1101 0000
0x90 = 1001 0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions