Repository navigation
Sort URLSearchParams by code units and keep equal names in order - #1415
Merged
FlorianRappl merged 2 commits intoNov 18, 2026
Merged
Conversation
URLSearchParams.sort() compared the names with the current culture and used an unstable sort. The standard sorts by UTF-16 code units and keeps the relative order of pairs with the same name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FlorianRappl
left a comment
Contributor
There was a problem hiding this comment.
This is fine - but it misses a CHANGELOG entry for 1.10.5 (as well as other version changes package.json and the Directory.Build.props).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks, added in ad385b0: a |
FlorianRappl
approved these changes
Nov 18, 2026
This was referenced Nov 18, 2026
This was referenced Nov 20, 2026
1 task
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of Changes
Prerequisites
Contribution Type
Description
There is no issue for this one; I found it while running the tests on a machine set to the Turkish culture.
UrlSearchParams.Sort()used_values.Sort((a, b) => a.Key.CompareTo(b.Key)), which differs from the URL Standard'ssort()in two ways:String.CompareTouses the current culture, so under tr-TR (and other cultures)asorts beforeA, where code-unit order putsA(U+0041) first.List<T>.Sortis not stable, so with more than 16 pairs, pairs with the same name come out reordered.The fix sorts with
OrderBy(p => p.Key, StringComparer.Ordinal), which is stable and compares code units, and writes the result back into the list.Tests (in
UrlSearchParamsIteration):SortOrdersTheNamesByCodeUnitsNotByCulture: fails before the change (Expected "A" but was "a" on this tr-TR machine).SortKeepsTheOrderOfPairsWithTheSameName: fails before the change (Expected 1 but was 19).Both pass with the change. The full
AngleSharp.Core.Testsrun on net10.0 passes (4881 passed, 1 skipped, same skip as before). I did not run the net462/net472 targets.This change was written with Claude Code.
🤖 Generated with Claude Code