by Michael S. Kaplan, published on 2005/09/09 10:38 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/09/09/462920.aspx
A developer at Microsoft recently asked me the following:
In control panel -> Regional options, the short date sample some times show national digit shapes. Is there any way, I can find out using an api which digit shape is used in the short date example of regional options?
The most important place to look is at GetLocaleInfo and specifically the LCTYPE values LOCALE_IDIGITSUBSTITUTION and LOCALE_SNATIVEDIGITS:
Value Meaning 0 Context - the shape depends on the previous text in the same output. 1 None/Arabic - gives full Unicode compatibility. 2 Native - national shapes determined by LOCALE_SNATIVEDIGITS.
Regional and Language Options uses GetDateFormat to get the formatted string and it is Uniscribe that takes the string when it is rendered and decides what to substitute, as appropriate.
You see, it is Uniscribe and more specifically the ScriptApplyDigitSubstitution and ScriptRecordDigitSubstitution functions (plus the supporting SCRIPT_DIGITSUBSTITUTE structure). Since Uniscribe has shipped in the box for every version of Windows since Windows 2000, the information about when and how to substitute digits is indeed valuable, and the Uniscribe implementation proves it. You can use these functions to do all of the "heavy lifting" for figuring out how to handle digits in a wide variety of situations....
This post brought to you by "๙" (U+0e59, a.k.a. THAI DIGIT NINE)
2006/06/18 The Phantom of the Digits
2006/02/22 And the digits just keep on coming
2006/01/18 Digits -- there is no substitute
go to newer or older post, or back to index or month or day