Home All Groups Group Topic Archive Search About

RegionInfo.ThreeLetterISORegionName returns TwoLetterIsoCode (BA)

Author
23 Dec 2005 9:25 PM
dpomt
Hi all,

sorry for posting this three times. Seems that I didn't configure my nospam
alias correctly.

I need to get the ISO-3166 code for BOSNIA AND HERZEGOVINA.
What I am trying is

1) RegionInfo ri = new RegionInfo(5146); ==> works fine and gets RegionInfo
2) ri.ThreeLetterISORegionName ==> Output "BA". Expected "BIH".

But I only get "BA" - not "BIH".

Any help greatly appreciated

I have noticed that BA/BIH is not listed in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationregioninfoclasstopic.asp
Might this be the problem?

I have also read about synthetic cultures
http://blogs.msdn.com/shawnste/archive/2005/12/06/500675.aspx

But anyway, BIH is a valid code found in ISO-3166.
Any ideas how to get it via RegionInfo?

Thanks,
DPOMT

Author
26 Dec 2005 9:36 AM
Peter Huang" [MSFT]
Hi

Based on the msdn in the link below, The following is a list of the
predefined RegionInfo names accepted and used by this class and other
classes in the System.Globalization namespace, which means other names is
not accepted or used by this class.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemglobalizationregioninfoclasstopic.asp

I think we can use the Win32 API GetLocaleInfo directly to do the job.

Locale Information
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_8r
se.asp

GetLocaleInfo
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_34
rz.asp

For detailed information, you can post in the newsgroup below.
microsoft.public.win32.programmer.international

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
1 Jan 2006 5:26 PM
dpomt
Peter,

thanks for your help.
I have done some analyses. GetLocaleInfo will not do the job.

I guess I have to wait for Windows Vista. GetLocaleInfoEx will then manage
my needs:

LOCALE_SISO3166CTRYNAME2
Windows Vista or later: Three-letter ISO region name (ISO 3166 three-letter
code for the country/region). For example, for the United States, this is
"USA".

Best regards,
Dieter
Author
3 Jan 2006 7:50 AM
Peter Huang" [MSFT]
Hi Dieter,

Thanks for your update!

Happy New Year!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

AddThis Social Bookmark Button