Skip to content

Unicode: ${#x} counts bytes, printf \u/\U escapes missing #362

@chaliy

Description

@chaliy

Description

Several unicode-related features are missing or incorrect.

Scope

  • ${#x} counts bytes not characters: x=café; echo ${#x} outputs 5 instead of 4
  • printf '\u03bc'\u unicode escape not implemented in printf
  • printf '\U000003bc'\U unicode escape not implemented in printf
  • $'\u03bc' — covered by Dollar single-quote $'' syntax not implemented #353 ($'' not implemented)

Repro

x=café
echo ${#x}
# bashkit outputs: 5 (byte count)
# expected: 4 (character count)

printf '\u03bc\n'
# bashkit outputs: \u03bc (literal backslash-u)
# expected: μ

Test coverage

6 skipped tests in crates/bashkit/tests/spec_cases/bash/unicode.test.sh (PR #351).

Oils reference: https://github.com/oilshell/oil/blob/master/spec/unicode.test.sh

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions