This problem contains many situation.
I think your fix doesn't work sometimes because:
1. osutils.get_user_encoding() is not good in rare case.
user_encoding is not equals to filesystem encoding.
2. path.encode(enc) can raise UnicodeEncodeError.
So bzr should use "encode(enc, 'replace')"
3. _write_file() writes file with unicode path.
But if bzr can't encode the path collectly, external command can't
open the file.
So bzr should encode the path before _write_file().
To test these situation:
* Use fixed encoding in the test.
* Use filenames that contains chars that can't encode with the encoding.
* Replace subprocess.call and check arguments.
This problem contains many situation.
I think your fix doesn't work sometimes because:
1. osutils. get_user_ encoding( ) is not good in rare case.
user_encoding is not equals to filesystem encoding.
2. path.encode(enc) can raise UnicodeEncodeError.
So bzr should use "encode(enc, 'replace')"
3. _write_file() writes file with unicode path.
But if bzr can't encode the path collectly, external command can't
open the file.
So bzr should encode the path before _write_file().
To test these situation:
* Use fixed encoding in the test.
* Use filenames that contains chars that can't encode with the encoding.
* Replace subprocess.call and check arguments.
--
INADA Naoki <email address hidden>