zsh-users
 help / color / mirror / code / Atom feed
From: ZyX <kp-pav@yandex.ru>
To: Ray Andrews <rayandrews@eastlink.ca>,
	"zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: utf-8
Date: Thu, 18 Dec 2014 21:05:12 +0300	[thread overview]
Message-ID: <1024051418925912@web2o.yandex.ru> (raw)
In-Reply-To: <549310A1.4080602@eastlink.ca>

18.12.2014, 20:38, "Ray Andrews" <rayandrews@eastlink.ca>:
> On 12/18/2014 01:25 AM, Peter Stephenson wrote:
>
> Mikael, Peter:
>>  Chapter 5 of the FAQ is the best place to start. You can see this
>>  online at http://zsh.sourceforge.net/FAQ/zshfaq05.html#l52. The
>>  version in Etc of the source is newer but I don't think there are
>>  significant differences. pws
>
> Very nicely written. That's exactly what I wanted to learn.  And tho I
> knew it
> previously, I had semi forgotten the difference between unicode and utf-8,
> which lead to the fuzzy question. To ask it again more accurately, where are
> extended unicode characters permitted? Or perhaps that's better reversed,
> where are they *not* permitted? Can a variable have a name beyond ASCII?
> I see that zsh is transparent to utf-8 everywhere, but that does not presume
> that one has use of the entire unicode charset in all situations.

It is permitted at least in variable and function names: though I cannot find anything relevant in manual regarding them, but code that implements `isident` function that is used to check for variable names (not function names, I do not know this part) indirectly uses library function `iswalnum` which in turn knows about unicode character classes (depends on LC_CTYPE).

AFAIK function name can be anything that is not parsed as anything else: the following definition works:

    '()' () {
        echo Test
    }

    \(\)
    # Outputs Test.

More:

    $PATH () {
        echo Test
    }

    /home/zyx/.gem/ruby/1.9.1/bin:<skip>:/opt/ekopath/bin
    # Outputs Test as well.

. It looks like zsh code was intentionally modified to use `iswalnum` for `itype_end` called from `isident`. It also appears that UTF-8 characters in IFS are also recognized: `itype_end` handles them as well and I do not think such handling was added without a reason. Everything is locale-bound in any case because libc functions are used and not something like icu.


  parent reply	other threads:[~2014-12-18 18:11 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 18:05 utf-8 Ray Andrews
2014-12-17 20:31 ` utf-8 ZyX
2014-12-18  0:39   ` utf-8 Ray Andrews
2014-12-18  6:48     ` utf-8 Павлов Николай Александрович
2014-12-18  9:25       ` utf-8 Mikael Magnusson
2014-12-18  9:25 ` utf-8 Peter Stephenson
2014-12-18 17:36   ` utf-8 Ray Andrews
2014-12-18 17:48     ` utf-8 Peter Stephenson
2014-12-18 18:14       ` utf-8 Ray Andrews
2014-12-18 18:22         ` utf-8 ZyX
2014-12-18 18:05     ` ZyX [this message]
2014-12-18 18:41       ` utf-8 Ray Andrews
2014-12-18 18:52         ` utf-8 ZyX
2014-12-18 20:04           ` utf-8 Ray Andrews
2014-12-18 20:12             ` utf-8 Peter Stephenson
2014-12-18 20:52             ` utf-8 ZyX
2014-12-18 21:15               ` utf-8 Ray Andrews
2014-12-18 21:38                 ` utf-8 ZyX
2014-12-18 23:55                   ` utf-8 Ray Andrews
2014-12-19  2:04                     ` utf-8 Bart Schaefer
2014-12-19  2:27                       ` utf-8 Ray Andrews
2014-12-19  2:32                         ` utf-8 Mikael Magnusson
2014-12-19  2:45                         ` utf-8 Bart Schaefer
2014-12-19  6:34                           ` utf-8 Ray Andrews
2014-12-19  7:02                             ` utf-8 Bart Schaefer
2014-12-19 17:04                               ` utf-8 Ray Andrews
2014-12-19 22:06                                 ` utf-8 ZyX
2014-12-19  7:29                             ` utf-8 Павлов Николай Александрович
2014-12-19  3:50                         ` utf-8 Lawrence Velázquez
2014-12-19  5:24                         ` utf-8 Павлов Николай Александрович
2014-12-19  5:18                     ` utf-8 Павлов Николай Александрович
     [not found] <BC9BC140-F1A5-11D5-BA73-000393164560@mas.ecp.fr>
2001-12-18 16:51 ` UTF-8 Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1024051418925912@web2o.yandex.ru \
    --to=kp-pav@yandex.ru \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).