~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cache_utf8.py

  • Committer: Robert Collins
  • Date: 2007-04-19 02:27:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2426.
  • Revision ID: robertc@robertcollins.net-20070419022744-pfdqz42kp1wizh43
``make docs`` now creates a man page at ``man1/bzr.1`` fixing bug 107388.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
_utf8_encode = codecs.getencoder("utf-8")
26
26
_utf8_decode = codecs.getdecoder("utf-8")
 
27
def _utf8_decode_with_None(bytestring, _utf8_decode=_utf8_decode):
 
28
    """wrap _utf8_decode to support None->None for optional strings.
 
29
 
 
30
    Also, only return the Unicode portion, since we don't care about the second
 
31
    return value.
 
32
    """
 
33
    if bytestring is None:
 
34
        return None
 
35
    else:
 
36
        return _utf8_decode(bytestring)[0]
27
37
 
28
38
# Map revisions from and to utf8 encoding
29
39
# Whenever we do an encode/decode operation, we save the result, so that