[tahoe-dev] #534: "tahoe cp" command encoding issue

Alberto Berti alberto at metapensiero.it
Sat Feb 28 03:07:49 UTC 2009


>>>>> "Francois" == Francois Deppierraz <francois at ctrlaltdel.ch> writes:

    Francois> What about using the object replacement character (U+FFFC)
    Francois> described on [1] as flag ?

mmm... python doc mentions U+FFFD as replacement character in 

http://docs.python.org/library/codecs.html#id1

    Francois> def fs_to_unicode(s): encoding =
    Francois> sys.getfilesystemencoding() try: return unicode(s,
    Francois> encoding) except UnicodeDecodeError: return u"\ufffc" +
    Francois> s.decode('latin-1')

    Francois> def unicode_to_fs(s): encoding =
    Francois> sys.getfilesystemencoding() if s[0] == u"\ufffc": return
    Francois> s[1:].encode('latin-1') else: return s.encode('utf-8')

I disagree with this strategy of inserting a flag as first byte of the
unicode filename. Older clients will treat it as part of the filename
and generic client maybe unaware of this detail and do the same mistake.

Alberto




More information about the tahoe-dev mailing list