Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15618 > unrolled thread
| Started by | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| First post | 2019-11-20 09:11 -0500 |
| Last post | 2019-11-20 09:11 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Locale not Obeyed by Parameter Expansion with Pattern Substitution Chet Ramey <chet.ramey@case.edu> - 2019-11-20 09:11 -0500
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Date | 2019-11-20 09:11 -0500 |
| Subject | Re: Locale not Obeyed by Parameter Expansion with Pattern Substitution |
| Message-ID | <mailman.2087.1574259130.13325.bug-bash@gnu.org> |
On 11/17/19 4:25 AM, Chris Carlen wrote:
> Bash Version: 5.0
> Patch Level: 0
> Release Status: release
>
> Description:
> UTF-8 multibyte char string split into bytes rather than characters.
>
> Repeat-By:
>
> #!/bin/bash
>
> shopt -s extglob
> LC_ALL="en_US.UTF-8"
>
> # E.g., normal/expected behavior:
>
> # Create a string:
> A=abc
>
> # Replace left virtual empty strings with spaces, putting separated
> # chars into positional parameters, then print them quoted:
> set -- ${A//?()/ }
> echo "${@@Q}" #-> 'a' 'b' 'c'
>
> # E.g., abnormal behavior:
>
> # write 'REVERSE PILCROW SIGN' to B, then repeat as above:
> printf -v B '\u204B'
> set -- ${B//?()/ }
> echo "${@@Q}" #-> $'\342' $'\201' $'\213'
Yes, this is a problem. The null match requires advancing through the
string by one character, instead of one byte. I'll fix it.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to top | Article view | gnu.bash.bug
csiph-web