�
�c@s2ddkZddkZddkZddkZddkZhdd<dd<Zy�eiid�Zei djo/eo'ei
eid�ei�dZnep)ei
�pdZeiee�ZnWneij
o
dZnXeiid d
�ZdZd�Zd
�Zd�ZdS(i�Ntasciit646sANSI_X3.4-1968t
HGENCODINGtdarwintitHGENCODINGMODEtstricts
ISO-8859-1cCs�xtdtfD]f}y#|i|�}|itd�SWq
tj
o}tid|��q
tj
oq
Xq
W|idd�}|itd�S(sm
Convert a string from internal UTF-8 to local encoding
All internal strings should be UTF-8 but some repos before the
implementation of locale support may contain latin1 or possibly
other character sets. We attempt to decode everything strictly
using UTF-8, then Latin-1, and failing that, we use UTF-8 and
replace unknown characters.
sUTF-8treplaces%%s, please check your locale settingssutf-8(tfallbackencodingtdecodetencodetencodingtLookupErrorterrortAborttUnicodeDecodeError(tstetutk((s%/sys/lib/python/mercurial/encoding.pyttolocals
cCs�y|itt�id�SWnytj
oF}|td|id�|id!}tid||f��n)t j
o}tid|��nXdS(s�
Convert a string from the local character encoding to UTF-8
We attempt to decode strings using the encoding mode set by
HGENCODINGMODE, which defaults to 'strict'. In this mode, unknown
characters will cause an error message. Other modes include
'replace', which replaces unknown characters with a special
Unicode character, and 'ignore', which drops the character.
sutf-8ii
sdecoding near '%s': %s!s%%s, please check your locale settingsN(
R RtencodingmodeR
RtmaxtstartR
RR(RtinsttsubR((s%/sys/lib/python/mercurial/encoding.pyt fromlocal2s
$cCsx|itd�}ttd�oLti}tg}|D]'}|||�djodpdq9~�Snt|�S(s3Find the column width of a UTF-8 string for displayRteast_asian_widthtWFii(R RthasattrtunicodedataRtsumtlen(Rtdtwt_[1]tc((s%/sys/lib/python/mercurial/encoding.pytcolwidthDs
C(R
tsysRtlocaletost_encodingfixuptenvirontgetRtplatformt setlocaletLC_CTYPEt getlocaletgetpreferredencodingtErrorRRRRR%(((s%/sys/lib/python/mercurial/encoding.pys<module>s"0
|