zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: multibyte FAQ (MacOS X)
Date: Mon, 19 Dec 2005 18:08:12 +0900	[thread overview]
Message-ID: <a06001001bfcc00a7dc70@kba.biglobe.ne.jp> (raw)
In-Reply-To: <200512181826.21268.arvidjaar@newmail.ru>

(I have subscribed to zsh-workers so no need to reply to me)

At 6:26 PM +0300 05.12.18, Andrey Borzenkov wrote:
>I wonder, when decomposition happens?

It seems that open(2) and opendir(2) accept both precomposed and decomposed form, but they internally convert the filename/dirname into decomposed form. For example

/* a-umlaut: precomposed */
name[0] = 0xc3; name[1] = 0xa4;
name[2] = 0x00;
fd = open(name,O_CREAT,mode);

has the same effect as

/* a + umlaut: decomposed */
name[0] = 0x61;			/* 'a' */
name[1] = 0xcc; name[2] = 0x88;	/* umlaut */
name[3] = 0x00;
fd = open(name,O_CREAT,mode);

and the created file has a filename in decomposed form.
readdir(2) always returns filenames in decomposed form (and UTF-8 encoding).

If a user input a-umlaut from his keyboard, then it is in precomposed form (at least for US and Japanese keyboards). But I think zsh need not to convert it into decomposed form. For example,

zsh% echo hello > Xa-umlaut    (two characters, 'X' and 'a-umlaut')

this works fine even if the 'a-umlaut' is in precomposed form. The created file has filename in decomposed form, and if I use filename completion

zsh% cat X<TAB>

then I get

zsh% cat Xa+umlaut

and the a+umlaut is in decomposed form. The decomposed char is displayed correctly both in Apple's Terminal (which runs in Apple's Aqua window system) and in xterm (with Unicode font, of course), but I can't edit the command line correctly.

You can test decomposed char as follows
(I assume insert-unicode-cahr is bound to ^XU)

zsh% echo ^XU61^XU^XU308^XU
a+umlaut
zsh% (go up in the history stack and try to edit it)


>To be sure - do you mean that e.g. accented characters are internally kept as 
>two characters? Does it agree with <http://www.unicode.org/reports/tr15/>?

How Apple decomposes characters can be found in
http://developer.apple.com/technotes/tn/tn1150table.html

I don't know whether this exactly follows the "Canonical Decomposition (Normalization Form D)" in the Unicode Standard; probably not. 


  reply	other threads:[~2005-12-19  9:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-14 18:31 PATCH: multibyte FAQ Peter Stephenson
2005-12-14 18:41 ` Peter Stephenson
2005-12-15 14:42   ` Peter Stephenson
2005-12-14 19:25 ` [22076] " Danek Duvall
2005-12-14 21:09   ` Peter Stephenson
2005-12-16  9:39     ` Danek Duvall
2005-12-16 17:13       ` Bart Schaefer
2005-12-18 19:38         ` Danek Duvall
2005-12-18 21:10           ` Bart Schaefer
2005-12-18 14:14 ` PATCH: multibyte FAQ (MacOS X) Jun T.
2005-12-18 15:26   ` Andrey Borzenkov
2005-12-19  9:08     ` Jun T. [this message]
2005-12-18 19:41   ` Peter Stephenson
2005-12-21 16:15     ` Peter Stephenson

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=a06001001bfcc00a7dc70@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@sunsite.dk \
    /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).