From 8f85ed7f5e96947a2f2cfee6f2bfce11f6cf04e5 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 29 Jan 2026 20:26:57 -0800 Subject: [PATCH] Normalize extension and private use tag subtags by applying case normalization and ordering using StringComparer.Ordinal. --- LanguageTags/LanguageTag.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/LanguageTags/LanguageTag.cs b/LanguageTags/LanguageTag.cs index cc60ac2..b0a04a2 100644 --- a/LanguageTags/LanguageTag.cs +++ b/LanguageTags/LanguageTag.cs @@ -324,7 +324,10 @@ internal ExtensionTag Normalize() => this with { Prefix = char.ToLowerInvariant(Prefix), - Tags = [.. Tags.Select(t => t.ToLowerInvariant()).OrderBy(t => t)], + Tags = + [ + .. Tags.Select(t => t.ToLowerInvariant()).OrderBy(t => t, StringComparer.Ordinal), + ], }; /// @@ -391,7 +394,10 @@ public override string ToString() => internal PrivateUseTag Normalize() => this with { - Tags = [.. Tags.Select(t => t.ToLowerInvariant()).OrderBy(t => t)], + Tags = + [ + .. Tags.Select(t => t.ToLowerInvariant()).OrderBy(t => t, StringComparer.Ordinal), + ], }; ///