Bug 1694518

Summary: Update unicodedata_db.h to include the latest UCD after Japanese new Era name is publicly announced.
Product: Red Hat Enterprise Linux 7 Reporter: Keigo Noha <knoha>
Component: pythonAssignee: Python Maintainers <python-maint>
Status: CLOSED WONTFIX QA Contact: RHEL CS Apps Subsystem QE <rhel-cs-apps-subsystem-qe>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.6CC: pkopkan, pviktori, vstinner
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-16 13:10:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1696002    

Description Keigo Noha 2019-04-01 01:57:30 UTC
Description of problem:
Update unicodedata_db.h to include the latest UCD after Japanese new Era name is publicly announced.

Version-Release number of selected component (if applicable):
Python2 in RHEL7.

Additional info:
Japanese government will announce the new Japanese Era name on April 1st.
After the announcement, the Unicode Consortium will map the new era name's ligature to U+32FF and they will update the Unicode Character Database for normalization.

This fix should be done in Python3 in RHEL8 also.

Comment 6 Petr Viktorin (pviktori) 2019-05-21 13:40:40 UTC
FWIW, the character is in Unicode 12.1

Comment 7 Victor Stinner 2019-05-21 13:51:09 UTC
There are 2 things:

* U+32FF character name: "SQUARE ERA NAME REIWA"
* U+32FF (㋿) character should be normalized as the two characters {U+4ee4, U+548c} (令和)

Example with Python 3.8 alpha 4 (3.8 dev branch) which uses Unicode 12.1.0:

Python 3.8.0a4+ (heads/master:4fb1502189, May 21 2019, 15:20:53) 
>>> import unicodedata
>>> unicodedata.name(u'\u32ff')
'SQUARE ERA NAME REIWA'
>>> print(ascii(unicodedata.normalize('NFKD', u'\u32ff')))
'\u4ee4\u548c'
>>> unicodedata.unidata_version
'12.1.0'

Python 3.7.3 on Fedora 29 uses Unicode 11.0 which isn't aware of U+32FF:

vstinner@apu$ python3
Python 3.7.3 (default, Mar 27 2019, 13:41:07) 
>>> import unicodedata
>>> print(ascii(unicodedata.normalize('NFKD', u'\u32ff')))
'\u32ff'
>>> unicodedata.name(u'\u32ff')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: no such name

The problem is that updating the Unicode database is tedious. It's not only a matter of updating the data. It's also about updating the *code* to respect newer Unicode standard. This work has been done in every release of Python 3.x.

Sadly, I don't think that this work can be done in Python 2.7 and 3.6 (to upgrade to Unicode 12.1 database).

Comment 8 Keigo Noha 2019-06-13 09:35:49 UTC
Hi Petr,

I'm sorry for the late.
If updating whole database makes possible trouble or regression, we just backport REIWA specific things into Python2.

Is it reasonable to the engineering team?

Kind Regards,
Keigo Noha

Comment 9 Victor Stinner 2019-06-17 09:35:06 UTC
> we just backport REIWA specific things into Python2

The Tools/unicode/makeunicodedata.py script builds Modules/unicodedata_db.h from the Unicode data files. I don't think that it's possible to modify Modules/unicodedata_db.h.

Comment 10 Petr Viktorin (pviktori) 2019-06-18 13:33:52 UTC
Can we get a list of the REIWA specific things?

Comment 11 Petr Viktorin (pviktori) 2019-07-16 13:10:42 UTC
Based on the info we have available, not updating Python's Unicode database is OK.
As the KB article says:

If your application use those functionality and request to update the hardcoded database, please open a support case to Red Hat Technical Support with an actual business impact by this issue.