MeirKriheli / python-bidi

BIDI algorithm related functions
GNU Lesser General Public License v3.0
105 stars 16 forks source link

Unexpected results for dates containing single digit Arabic numerals #8

Closed superbland closed 2 months ago

superbland commented 7 years ago

A string passed to get_display in the format of dd month yyyy - dd month yyyy will yield different ordering if the day is a single digit.


OSX 10.11.6 Python 3.5.1 python-bidi 0.4.0


Steps to reproduce:

get_display('٢٦ أكتوبر ١٩٤٥-١٥ أبريل ١٩٤٦')
'١٩٤٦ ليربأ ١٥-١٩٤٥ ربوتكأ ٢٦'
get_display('٢ أكتوبر ١٩٤٥-١٥ أبريل ١٩٤٦')
'١٩٤٦ ليربأ ١٥-٢ أكتوبر ١٩٤٥'

Read from right to left, the above will generate:

My steps around this for now will be prepend single digit day values with a leading zero (٠), which gives me the consistent format I expect, however this seems like a bug to me?

dkinitz commented 4 years ago

After installing python-bidi 0.4.2 the mistake does not occur anymore. get_display('٢ أكتوبر ١٩٤٥-١٥ أبريل ١٩٤٦') [Out:] '١٩٤٦ ليربأ ١٥-١٩٤٥ ربوتكأ ٢'