i18n bug regarding Arabic-Indic numbers needinfo.
Lars Knoll
lars at trolltech.com
Sun Apr 25 22:33:18 BST 2004
On Saturday 24 April 2004 19:07, Thiago Macieira wrote:
> Shaheed wrote:
> >> QString num1 = QString::fromUtf8("٠٥٠-٦٦٧١١");
> >>
> >> for (unsigned int i=0; i<num1.length(); i++)
> >> {
> >> QChar c = num1[i];
> >> if (c.isDigit())
> >> c = c.digitValue() + '0';
> >> num1[i] = c;
> >> }
> >>
> >> cout << num1 << endl;
> >
> >I can confirm the Bengali equivalent works just fine:
> >
> >QString::fromUtf8("০৫০-৬৬৭৭১");
>
> Of course, this will only work if you're converting digits (like a phone
> number) to and from base 10. If you stumble over a digit whose value is
> 11, you'll end up with '0' + 11 = ';'.
>
> Now, I don't know if there is any script in Unicode that uses base 12,
> 20 or something else, but there's nothing stopping it.
QChar::digitValue() always returns a number smaller than 10.
> As for numbers, not just a sequence of digits, you may want to be aware
> that some scripts may decide to put the least significant digit first,
> so you may have to reorder. But, again, I don't know if there is
> currently any such script in Unicode.
There is fortunately no such script in Unicode currently.
Lars
More information about the kde-core-devel
mailing list