[mc] User menu: pattern matching acts not as expected

Yury V. Zaytsev yury at shurup.com
Wed Mar 12 15:29:32 UTC 2025


> On 12. Mar 2025, at 16:03, Yury V. Zaytsev via mc <mc at lists.midnight-commander.org> wrote:
> 
>> I tried my old mc on one system (4.8.22 too) and *[[:space:]]* selects the file with "nonlocal" chars if I try, assume Eugen's renaming should work as well (although I didn't check, whether the regex interpretion works similar in both cases)
>> 
>> But being in an utf charset too I can't imagine why "à" or "á" shall be "nonlocal" here. Seems more likely there is some charset mismatch on Eugen's system, at least for the acting user. Maybe there are "invisible" chars in the name in his environment…
> 
> ... but thanks for reproducing it. I can confirm that it doesn't seem to work correctly on 4.8.33. I'll try a debug build on the master to see what happens.

Looking deeper into the code, it does

  mc_search (arg, DEFAULT_CHARSET, fe->fname->str, search_type);

where DEFAULT_CHARSET is ASCII. The attached patch "fixes" the problem, but I'm afraid it's much more complicated.

Even if we declare that menu files must be UTF-8 and that's it, I'm not sure that this takes care of correct matching when single-byte locales are used. Maybe the source string should be recoded somehow as well? It would be good to hear what Andrew has to say about this.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-usermenu-matching.patch
Type: application/octet-stream
Size: 2221 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc/attachments/20250312/0ba7f2d8/attachment.obj>


More information about the mc mailing list