A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-November/106189.html below:

[Python-Dev] Python and the Unicode Character Database

[Python-Dev] Python and the Unicode Character Database [Python-Dev] Python and the Unicode Character DatabaseAlexander Belopolsky alexander.belopolsky at gmail.com
Tue Nov 30 19:21:30 CET 2010
On Tue, Nov 30, 2010 at 12:40 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
..
>> If you think non-ASCII digits are not difficult to support, please
>> contribute to the following tracker issues:
>>
>
> Would moving this functionality to the locale module make the issues any
> easier to fix?
>

Sure, if we code it in Python, supporting it will by much easier:

def normalize_digits(s):
    digits = {m.group(1) for m in re.finditer('(\d)', s)}
    trtab = {ord(d): str(unicodedata.digit(d)) for d in digits}
    return s.translate(trtab)

>>> normalize_digits('١٢٣٤.٥٦')
'1234.56'

I am not sure this belongs to the locale module, however.  It seems to
me, something like 'unicodealgo' for unicode algorithms would be more
appropriate.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4