Skip to content

rev: multibyte characters are reversed byte by byte in UTF-8 locales #656

Open

Description

@SichenLiang

uutils rev reverses each line byte by byte even in a UTF-8 locale. This reverses the bytes inside every multibyte character and produces invalid UTF-8. util-linux 2.42.4 reverses the order of code points instead.

Set UTIL_LINUX_REV to the absolute path to the rev binary from util-linux 2.42.4.

printf 'aé中🙂b\ne\314\201x\n' | LC_ALL=C.UTF-8 "$UTIL_LINUX_REV"

util-linux prints b🙂中éa, followed by x, U+0301, and e. uutils reverses the bytes inside é, 中, 🙂, and the combining mark.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions