Skip to content

Directory history breaks accents in 8-bit locales #4819

@egmontkob

Description

@egmontkob

Is there an existing issue for this?

  • I have searched the existing issues

Midnight Commander version and build configuration

4.8.33

Operating system

Linux

Is this issue reproducible using the latest version of Midnight Commander?

  • I confirm the issue is still reproducible with the latest version of Midnight Commander

How to reproduce

With an 8-bit locale, navigate to a directory which has some accents (probably in UTF-8, thus right now showing up incorrectly). Quit mc.

Notice that .local/share/mc/history, under Dir Hist New [Left/Right] Panel, contains this entry encoded in "double UTF-8", each byte represented by the corresponding Unicode codepoint (up to U+00FF) encoded in UTF-8.

Start mc with an UTF-8 locale, click on the dropdown entry at the panel's upper right corner to open the directory listing. This recent entry is shown incorrectly. Selecting it doesn't take you to that directory.

Unix treats filenames as byte sequences, rather than Unicode character sequences. Accordingly, we should store unmodified byte sequences in the history file (possibly backslash-escaping high bytes).

(I'm not quite sure whether other sections in that file, e.g. mc.shared.search, inpmc.fm.mkdir or cmdline should also be byte-safe, or if here it's more important to keep the user-visible string the same across locale changes even if it means changing the underlying byte sequence.)

Expected behavior

.

Actual behavior

.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configConfiguration INI filesprio: mediumHas the potential to affect progress

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions