Closed cyrillgisin closed 4 years ago
This is fixed in https://github.com/codebude/QRCoder/commit/7e6cc9284383f13f3b49c49461acc2c584684227 Since .NET still doesn't bring a complete list/all-in-one solution for the ISO codes, I decided to add an external solution. If you disagree with the code changes, feel free to re-open the issue. :-)
Type of issue
[x ] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement
Expected Behavior
When instantiating a new Contact, the library should not check the ISO 3166-1 (two letters) code with CultureInfo.GetCulture() because this list is incomplete.
Current Behavior
The library throws a SwissQrCodeContactException.
Possible Solution (optional)
Class: PayloadGenerator. Private constructor for Contact. Please remove the following lines of code:
if (!((IEnumerable<CultureInfo>) CultureInfo.GetCultures(CultureTypes.SpecificCultures)).Where<CultureInfo>((Func<CultureInfo, bool>) (x => new RegionInfo(x.LCID).TwoLetterISORegionName.ToUpper() == country.ToUpper())).Any<CultureInfo>()) throw new PayloadGenerator.SwissQrCode.Contact.SwissQrCodeContactException("Country must be a valid \"two letter\" country code as defined by ISO 3166-1, but it isn't.");
Steps to Reproduce (for bugs)
Instantiate a Contact with the Two-letter-code "GH" for Ghana (parameter: "country"), which is an official ISO 3166-1 code but missing in CultureInfo.GetCultures() from .Net Framework
Your Environment
Not relevant