Re: Unicode is universal, so how come that universality doesn’t apply to digits?

William_J_G Overington wjgo_10009 at btinternet.com
Wed Dec 16 10:02:00 CST 2020


Hi

Well, is the way to make progress that Unicode Inc. could make available 
a pseudo-code algorithm that can be converted to various programming 
languages that is such that the way that a digit is derived from the 
text characters is an algorithm with a structure of the form

if (digit_character >= 'A') AND (digit_character <= 'B') then 
digit_number := digit_character - 'C'

elsif (digit_character >= 'D') AND (digit_character <= 'E') then 
digit_number := digit_character - 'F'

elsif ...

.
.
.

elsif ...

end;

where A, B, C, D etc in the above are here each a placeholder for a 
Unicode character for the start and end of a range of digit characters 
as appropriate?

Would that do it? Assuming that compiler manufacturers used the 
algorithm, converted as appropriate! :-)

The algorithm written once and then updated as needed by Unicode Inc., 
then applicable throughout many programming languages.

Best regards,

William Overington

Wednesday 16 December 2020


------ Original Message ------
From: "Roger L Costello via Unicode" <unicode at unicode.org>
To: "unicode at unicode.org" <unicode at unicode.org>
Sent: Wednesday, 2020 Dec 16 At 13:47
Subject: Unicode is universal, so how come that universality doesn’t 
apply to digits?


Hi Folks,
Unicode make it possible to write things in different languages.
For example, rather than this XML:
<Number_Students>42</Number_Students>
a Bengali-speaking person can write this:
<সংখ্যা_ছাত্র>42</সংখ্যা_ছাত্র>
Or, in a programming language, rather than this assignment statement:
               Number_Students = 42
a Bengali-speaking person can write this:
                সংখ্যা_ছাত্র = 42
That’s awesome.
But, but, but, … how come that universality doesn’t extend to digits?
How come we can only use these digits: 0 (hex 30), 1 (hex 31), …, 9 (hex 
39)?
Why, for example, can’t a Bengali-speaking person use the Bengali 
digits: Bengali digit 0 (U+09E6), Bengali digit 1 (U+09E7), …, Bengali 
digit 9 (U+09EF)?
Why, for example, can’t a Bengali-speaking person create XML such as 
this:
<সংখ্যা_ছাত্র>৪୨</সংখ্যা_ছাত্র>
or write a program assignment statement like this:
                সংখ্যা_ছাত্র =  ৪୨
Let me explain why I assert that the Bengali-speaking person “cannot” do 
that.
Numbers in an XML document or in a program are just strings and, to 
perform arithmetic operations on them, those string numbers must be 
converted to actual numbers. I looked at the source code for the C 
function (strtol) that converts strings  to numbers and here is the key 
to how it converts a character digit to a number digit:
               digit_number = digit_character - '0’
Yikes!
That generates a number digit by treating the character digit as a 
number and subtracting the number corresponding to the character ‘0’. 
For example, if the character digit is ‘4’ (hex 34) then when we 
subtract ‘0’ (hex 30) we get the number  4. Perfect! But ……… only if we 
allow European digits (0, 1, …, 9). Clearly, if we were to subtract ‘0’ 
(hex 30) from the Bengali digit 4 we do not get the number 4.
Thus I conclude:
    *  When expressing numbers, the only digits that can be used are the 
European digits
    *  Unicode is universal, but that universality does not apply to 
digits or numbers

Obviously I am not understanding something correctly. Please help me to 
understand.
/Roger


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://corp.unicode.org/pipermail/unicode/attachments/20201216/abdf7925/attachment-0001.htm>


More information about the Unicode mailing list