[issue37180] Fix Persian KAF in mac_farsi.py

STINNER Victor report at bugs.python.org
Fri Jun 7 12:08:24 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

> Regarding the file named: "Lib/encodings/mac_farsi.py", the numbers are inserted in the wrong way, they are inserted Arabic numbers instead of Persian, they are edited in the comment.

Python implements the Unicode standard. In the master branch, it's the Unicode standard version 11.0. It gives these character names:

$ python3
>>> import unicodedata
>>> for ch in list(range(0x06f0, 0x06f9+1)) + [0x06A9]:
...  print("U+%04x: %s" % (ch, unicodedata.name(chr(ch))))
... 

U+06f0: EXTENDED ARABIC-INDIC DIGIT ZERO
U+06f1: EXTENDED ARABIC-INDIC DIGIT ONE
U+06f2: EXTENDED ARABIC-INDIC DIGIT TWO
U+06f3: EXTENDED ARABIC-INDIC DIGIT THREE
U+06f4: EXTENDED ARABIC-INDIC DIGIT FOUR
U+06f5: EXTENDED ARABIC-INDIC DIGIT FIVE
U+06f6: EXTENDED ARABIC-INDIC DIGIT SIX
U+06f7: EXTENDED ARABIC-INDIC DIGIT SEVEN
U+06f8: EXTENDED ARABIC-INDIC DIGIT EIGHT
U+06f9: EXTENDED ARABIC-INDIC DIGIT NINE
U+06a9: ARABIC LETTER KEHEH

>>> unicodedata.unidata_version
'11.0.0'

I still see "ARABIC" in character names.

> The KAF character (ك)

That's the Unicode character: U+0643 called "ARABIC LETTER KAF".

Comments in https://github.com/python/cpython/blob/master/Lib/encodings/mac_farsi.py still seems to be up to date.

SilentGhost:
> The replacement character that you're proposing is called (according to the same database) 'ARABIC LETTER KEHEH', whereas the old one was 'ARABIC LETTER KAF'. This encoding was originally generated based on data from unicode.org, I'd think a reference would be needed making clear that this is indeed a valid replacement.

mac_farsi.py docstring says:

""" Python Character Mapping Codec mac_farsi generated from 'MAPPINGS/VENDORS/APPLE/FARSI.TXT' with gencodec.py.

The mapping comes from Unicode. Was it updated since this file was created?

The latest change in this file was made in 2007, a few years ago :-)

--

I don't see anything wrong, I suggest to close the issue.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37180>
_______________________________________


More information about the Python-bugs-list mailing list