Skip to content

fix(codes): accept any letter case and surrounding whitespace in ISO … - #454

Merged
yezz123 merged 1 commit into
pydantic:mainfrom
RavSinghChandan:script-code-case-whitespace
Oct 19, 2026
Merged

yezz123 merged 1 commit into
pydantic:mainfrom
RavSinghChandan:script-code-case-whitespace

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

…15924 script codesFollow-up to #451. ISO_15924 only accepted the exact form "Latn": "latn" and "LATN" were rejected as invalid codes, and " Latn " failed with "String should have at most 4 characters". The country, currency and language code types accept any letter case and, since #451, surrounding whitespace.

ISO_15924 now strips surrounding whitespace in its string schema and normalises the case to the canonical form (initial capital, as every code in pycountry is written), so all of these give "Latn". Whitespace inside a code is still rejected. Added cases to tests/test_scripts.py.

@yezz123
yezz123 merged commit f30ecdb into pydantic:main Oct 19, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants