The Phantom of the Digits

by Michael S. Kaplan, published on 2006/06/18 14:25 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/06/18/636180.aspx


If you are a regular reader of this blog you probably know about how I can't seem to stop bringing up digit substitution.

There is, however, something I forgot to mention about it. So I will take advantage of the dynamic nature of blogs and bring it up now. :-)

I'll start with the setting itself....

Although I have described the setting and its issues/limitations/implementation flaws at length, I never clearly explained the most important part about it.

It is all an illusion.

That is right, this fancy setting is not changing the underlying storage from good old

0 1 2 3 4 5 6 7 8 9

no matter what it looks like on the screen. So if you deal with contents of controls through Win32 APIa/messages or through accessibility hooks, you will not see the Hindi, Thai, Devanagari, or other digits in the program.

Usually the text is being placed somewhere else in the UI which is also affected by the same digit substitution setting, so you may not notice. :-)

Now if you think about all this, it makes sense. As a feature digit substitution is not trying to make every single digit an equivalent, so if you were to literally use the Hindi digits then no setting in Regional and Language Options will alter them. It has the simple job of making the plain old ASCII digits look like one of the other subranges.

In its own way, this is the opposite of what FoldString with the MAP_FOLDDIGITS flag does -- takes all of those other digits and maps them back to the ASCII ones!

(Of course when I talk about ASCII digits here I am still assuming Unicode, I am just talking about the ones down in that U+0030 to U+0039 range!)

So, the next time you are looking at some post of mine (or somebody else's) about digit substitution, be sure to remember that it is all just for show.

And beware the phantom of digit substitution!

 

This post brought to you by 5 (U+0035, a.k.a. DIGIT FIVE)


# Ben Cooke on 19 Jun 2006 4:24 PM:

I do enjoy finding out what all of those spaces all over the Regional and Language Options dialog are for (though once I noticed what was going on, I did cheat and just poke around in the dialog resource to see what I was missing :) ) but each time I wonder if there's some way that my English copy of Windows can get at those options.

I don't really need digit substitution or whatnot in everyday use, but it would certainly be nice to be able to test my apps with these settings to make sure they properly respect them. Is it possible?

# Michael S. Kaplan on 19 Jun 2006 4:27 PM:

Hi Ben,

The easiest way is changing your user locale to Arabic and then looking at any formatted numbers you have -- if the digit substitution is set by you are seeing our (Arabic-Indic) digits rather than the Arabic (Hindi) digits, then you have a bug....

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2010/11/12 Suddenly, in a bit more time than a blink of an eye, "standards support" becomes "less i18n support"

2008/10/02 When swimming in a sea of CONTEXT, applications can drown (and there is no lifeguard)

2007/02/14 Nothing seems to be parsing the crap out of *this* number

2006/06/19 Correct? Intuitive? Both? Neither?

go to newer or older post, or back to index or month or day