none
CultureInfo.GetCultureInfo behavior change on Windows 10 RRS feed

  • Question

  • On versions prior to Windows 10 CultureInfo.GetCultureInfo("xx") would throw an exception.  Now a CultureInfo object is returned with DisplayName  "Unknown Language (xx)"  Is this related to BCP-47?  Is this correct and if so what is the correct method to determine if a language code is valid?
    • Edited by bk37 Friday, August 21, 2015 6:13 PM
    Friday, August 21, 2015 6:13 PM

Answers

  • Took a while to find but I managed to locate the MSDN entry that sheds some light on this. There is a change in Windows 10 that causes this.

    You can look at the CultureTypes property or LCID to see if the returned culture info instance is an existing known culture or not.

    CultureTypes will have flag UserCustomCulture if it is not known or incomplete culture.

    LCID will be 0x1000 (4096) when it is not known/incomplete.

    https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes%28v=vs.110%29.aspx

    • Proposed as answer by Blackwood Saturday, August 22, 2015 12:46 PM
    • Marked as answer by bk37 Monday, August 24, 2015 2:53 PM
    Saturday, August 22, 2015 11:26 AM
    Moderator

All replies

  • Took a while to find but I managed to locate the MSDN entry that sheds some light on this. There is a change in Windows 10 that causes this.

    You can look at the CultureTypes property or LCID to see if the returned culture info instance is an existing known culture or not.

    CultureTypes will have flag UserCustomCulture if it is not known or incomplete culture.

    LCID will be 0x1000 (4096) when it is not known/incomplete.

    https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes%28v=vs.110%29.aspx

    • Proposed as answer by Blackwood Saturday, August 22, 2015 12:46 PM
    • Marked as answer by bk37 Monday, August 24, 2015 2:53 PM
    Saturday, August 22, 2015 11:26 AM
    Moderator
  • Thanks Andreas, chose the CultureTypes property with the corresponding CultureTypes enum option for clarity.
    Monday, August 24, 2015 2:53 PM