Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: UTF-8 input [was Re: PATCH: zle_params.c]



Bart Schaefer wrote:
> So if, for example, I do
> 
> 	BUFFER="$LBUFFER$KEYS$RBUFFER"
> 
> this is going to convert LBUFFER and RBUFFER from wide chars to metafied
> on expansion, and then convert the whole quoted string back to wide chars
> upon assignment?

Yes, the ZLE parameter interface is responsible for the conversion of
the bits of the buffer in both directions, and, as it happens, $KEYS
doesn't need converting.

> } I suspect we will want a flag such as ${(m)#KEYS} to treat the string
> } as a multibyte character string instead of raw bytes and maybe a
> } ${(M)#KEYS} not to.
> 
> (M) is already taken, as are (w) and (W).

I missed that, but maybe we don't need it if the default is raw bytes.

> I presume you mean (m) to be like (c) in that it works only with ${#...}.
> Otherwise I'm even more confused.

Well, it would be anywhere the distinction made sense, but counting
lengths is the only obvious one.  Anywhere involving pattern matching
would need to go with the locale, I would think; anything else is too
horrendous to contemplate.

> } [...] argue for it to handle multibyte strings by default in a suitable
> } locale, but when Perl did that it broke everything in sight.
> 
> I'm not arguing for that ... if anything, I'm arguing against it.

Compatibility with other shells would be the only good reason I can see,
but that could be an option.  There are plenty of
do_something_done_by_other_shells_however_idiotic options.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author