Skip to content

uniq: skip characters, not bytes, for -s in a UTF-8 locale - #16684

Open
Xnadir wants to merge 1 commit into
uutils:mainfrom
Xnadir:uniq-skip-chars-utf8
Open

Xnadir wants to merge 1 commit into
uutils:mainfrom
Xnadir:uniq-skip-chars-utf8

Conversation

@Xnadir

@Xnadir Xnadir commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

In a UTF-8 locale, -s N skipped N bytes instead of N characters, so printf 'éxy\nABxy\n' | uniq -s 2 -c compared xy with xy and merged the two lines. GNU skips two characters and compares y with xy.

-s now counts characters the same way -w already does: characters for valid UTF-8 outside the C locale, bytes otherwise. The new test covers both locales and fails on main.

Closes #16661

AI disclosure: written with help from Claude Code.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 14:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

This branch has not been deployed

No deployments
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.

uniq: --skip-chars merges distinct lines in a UTF-8 locale

2 participants