Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15618

Re: Locale not Obeyed by Parameter Expansion with Pattern Substitution

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Locale not Obeyed by Parameter Expansion with Pattern Substitution
Date 2019-11-20 09:11 -0500
Message-ID <mailman.2087.1574259130.13325.bug-bash@gnu.org> (permalink)
References <0acc4767-e87f-f163-b39e-f137effdfea2.ref@sbcglobal.net> <0acc4767-e87f-f163-b39e-f137effdfea2@sbcglobal.net> <b1deb903-fe72-e8e1-5357-d2d500a1da83@case.edu>

Show all headers | View raw


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 gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Locale not Obeyed by Parameter Expansion with Pattern Substitution Chet Ramey <chet.ramey@case.edu> - 2019-11-20 09:11 -0500

csiph-web