Re: [PATCH 0/8] Add multi-byte support
Herbert Xu <[email protected]>
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <Zi+czPiT/X/[email protected]> |
On Sun, Apr 28, 2024 at 03:50:57PM +0100, Harald van Dijk wrote:
>
> The way you are implementing it, once you get to pmatch(), arguably you will
> not handle ${foo%.} correctly.
I took the easy way out so for now only the fnmatch path works
properly. But eventually I will get to the pmatch path too,
especially because fnmatch(3) seems to slow down quite a bit
once locale is set.
> This is something I expect to set foo to '\303', and it does in all shells I
> know of, despite POSIX not saying this needs to work. The way you are
> implementing multibyte character support, if I am reading it right, as long
> as a full multibyte character has not been read, the next byte will be taken
> as part of that multibyte character, meaning you will take '\303.' as a
> single invalid multibyte character.
A multi-byte character has to be valid according to mbrtowc
before I mark it with MBCHAR. Otherwise it'll be treated as
just a single-byte character.
Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt