On Thu, 22 Nov 2007 14:43:21 +0100, Vladimir Nadvornik <nadvornik suse cz> wrote:
It seems that there is the same bug as in the old utf8 patches: move andcopy should preserve the original broken sequences, i.e. it should be possibleto copy a file with 8859 name even if mc is in utf-8 mode. Both versions of utf-8 patch replace the invalid utf-8 sequences with questionmarks in target file name.
Another place where I have been inspired by first utf-8 patch. Move/copy/delete dialogs use re_match function, that does not work with invalid utf-8 strings. So every incorrect sequences are replaced with question mark before calling re_match. I have thought that is not possible keep them. But solution seems to be quite simple. str_fix_string does not affect size of string and re_match return relative positions of matches in string. So re_match is called with fixed fnsource, but following cycle uses original and possible invalid fnsource. It works fine on simple source masks like "*". I think that only case, where could be this useful. I'm only not sure if question mark is the best replacement character in this case. I have made standalone fix-01-copymove.patch (attached) for testing. If it solved this bug, I will added it directly in my utf-8 patches. (trick: if you set #enc:utf8, you will see only valid file names)
Attachment:
fix-01-copymove.patch
Description: Binary data