[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: i18n bug regarding Arabic-Indic numbers needinfo.
From:       Lars Knoll <lars () trolltech ! com>
Date:       2004-04-25 21:33:18
Message-ID: 200404252333.18967.lars () trolltech ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic