Skip to content

Commit

Permalink
ensure country codes are capitalized per ISO specs (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdock authored Mar 20, 2023
1 parent e0d410b commit f074a9b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PhoneNumberKit/PhoneNumberKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ public final class PhoneNumberKit: NSObject {
// macCatalyst OS bug if language is set to Korean
//CNContactsUserDefaults.shared().countryCode will return ko instead of kr
// Failed parsing any phone number.
let countryCode = CNContactsUserDefaults.shared().countryCode
let countryCode = CNContactsUserDefaults.shared().countryCode.uppercased()
#if targetEnvironment(macCatalyst)
if "ko".caseInsensitiveCompare(countryCode) == .orderedSame {
return "kr"
return "KR"
}
#endif
return countryCode
Expand All @@ -316,6 +316,8 @@ public final class PhoneNumberKit: NSObject {
}
return PhoneNumberConstants.defaultCountry
}



/// Default metadata callback, reads metadata from PhoneNumberMetadata.json file in bundle
///
Expand Down

0 comments on commit f074a9b

Please sign in to comment.