Digits -- there is no substitute

Sorting it all Out
Michael Kaplan's random stuff of dubious value
Be sure to read the disclaimer here first!

Digits -- there is no substitute

  • Comments 6

I have kind of talked about digit substitution now and again since I started with this blog.

And I went on and on about the impressive model for the future in the Is Whidbey's international support finished? post, and after all the work was done in Whidbey to make sure that if you tried to make assignments to the new NumberFormatInfo.NativeDigits property -- there had to be exactly ten, they had  to all have the Nd general category with a value that matched the position the characters were in (so you could not turn 5 into 7 or whatever).

Of course if I only knew then what I know now I may not have worked with people to have such functionality working so hard to validate the input!

Why, you might ask?

Well, it turns out that the values are not used by either Windows or the .NET Framework, at least not in the way that you might think....

You see, both GDI+ and Uniscribe have hardcoded lists of digits, and if you are going through one of them and you have your LOCALE_IDIGITSUBSTITUTION set to context or native and then digit substitution becomes appropiate, it will look at just one of the digits and then use its script characteristics to pick from the hardcoded list of digits.

They arbitrarily decided to go with the DIGIT ONE value since at the time this work was initially done the Tamil script had no TAMIL DIGIT ZERO (it has since been added at U+0be6).

So it really does not matter from the Microsoft point of view what is in NumberFormatInfo.NativeDigits or LOCALE_SNATIVEDIGITS via GetLocaleInfo, other that first digit -- and only then if they know about that digit.

Here is definitely a limitation to be addressed for a future version....

Though in the meantime it is data that is available in applications that want to use the data correctly. No one has to wait for MS to get around to using it right. :-)

 

This post brought to you by U+0be6, a.k.a. TAMIL DIGIT ZERO

Comment on the blather
Leave a Comment
  • Please add 7 and 4 and type the answer here:
  • Post
Blog - Comment List
  • I have definitely talked about digit substitution many times since I started with this blog.
    And then...

  • If you are a regular reader of this blog you probably know about how I can't seem to stop bringing...
  • Reader Grieg Winter asked via the Contact link at one of those weird transitional days when the Suggestion

  • Content of Michael Kaplan's personal blog not approved by Microsoft (see disclaimer )! Regular readers

  • Now I have talked about the good, the bad, the ugly, the pretty, the ins, and the outs of digit substitution

  • Reader Angel asked about Digit Substitution:

    Hello Michael!

    I randomly found your blog while googling

Page 1 of 1 (6 items)