Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/src/cmd/hg/mercurial/encoding.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
�c@s2ddkZddkZddkZddkZddkZhdd<dd<Zy�eiid�Zei	djo/eo'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./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	RtencodingmodeR
RtmaxtstartR
RR(RtinsttsubR((s./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./mercurial/encoding.pytcolwidthDs
	C(R
tsysRtlocaletost_encodingfixuptenvirontgetRtplatformt	setlocaletLC_CTYPEt	getlocaletgetpreferredencodingtErrorRRRRR%(((s./mercurial/encoding.pys<module>s"0		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].