This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix Persian KAF in mac_farsi.py
Type: behavior Stage: resolved
Components: macOS, Unicode Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: RaminNietzsche, SilentGhost, ezio.melotti, lemburg, ned.deily, ronaldoussoren, vstinner
Priority: normal Keywords: patch

Created on 2019-06-06 18:35 by RaminNietzsche, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13871 closed RaminNietzsche, 2019-06-06 18:42
Messages (4)
msg344850 - (view) Author: Ramin Najjarbashi (RaminNietzsche) * Date: 2019-06-06 18:35
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.
The KAF character (ك) which was the Arabic version, has been changed and edited to the Persian version(ک).

It's not a big deal, but it's my first step to improve my favorite language ;)
msg344855 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-06-06 19:15
The names of the characters given in comments agree with the unicode database name (they're indeed ARABIC-INDIC DIGITs and ARABIC LETTER).

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.
msg344958 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-07 16:08
> 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.
msg344972 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-06-07 17:03
Ramin, I agree with Victor, if you have any information contrary to what we posted, please feel free to post it here so that we can consider re-opening the issue.
History
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81361
2019-06-07 17:03:23SilentGhostsetstatus: open -> closed
resolution: not a bug
messages: + msg344972

stage: patch review -> resolved
2019-06-07 16:08:24vstinnersetmessages: + msg344958
2019-06-06 19:22:21ned.deilysetnosy: + lemburg
2019-06-06 19:15:24SilentGhostsetversions: + Python 3.7, Python 3.8
nosy: + vstinner, ned.deily, ezio.melotti, SilentGhost, ronaldoussoren

messages: + msg344855

components: + macOS, Unicode
type: enhancement -> behavior
2019-06-06 18:42:42RaminNietzschesetkeywords: + patch
stage: patch review
pull_requests: + pull_request13747
2019-06-06 18:35:53RaminNietzschecreate