`expr length xxx` retruns the number of multibyte characters in RHEL8 and later.

Solution Verified - Updated -

Issue

  • The output of expr length xxx differs between RHEL 6 and RHEL 8 when multibyte characters are specified.

It returns the number of bytes in RHEL 6:

# expr length "あいうえおABCDE"
20

It returns the number of multibyte characters in RHEL 8:

# expr length "あいうえおABCDE"
10

Environment

  • Red Hat Enterprise Linux 8 or later

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content