If it isn't working, try being a tad more literal about it....

by Michael S. Kaplan, published on 2011/10/11 07:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2011/10/11/10223101.aspx


Yesterday, someone was having problems with Locale Builder.

And with the locales themselves, in some cases.

The problem goes something like this:

Short date format #1, that has period delimiters, works just fine -- see the Preview?

And short date format #2, which has dashes as the delimiter, also looks good. See the Preview?

But if you look at the two added formats at the bottom of the list, things get more confusing:

   

What the hell is going on here, exactly?

Well, it comes down to the fact that (since Vista RTM) derived LOCALE_SDATE happens to be U+002e (FULL STOP).

Now its just so happens that / (aka U+002f aka SOLIDUS) is a special charactr to NLS.

It is the placeholder in which to insert the LOCALE_SDATE value.

Crap.

How can you get the SOLIDUS to not be misunderstood as the placeholder?

Ah, that part is easy -- just create a format that specifies the character as a literal, thus:

   

In other words, adding

dd'/'MM'/'yyyy

when you want

dd/MM/yyyy

and so on....

 Now remember that with LOCALE_SDATE being dervied, it is always going to be safer to specify the format with litearals....


no comments

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.

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