unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@etl.go.jp>
Cc: bug-gnu-emacs@gnu.org, d.love@dl.ac.uk
Subject: Re: decode-char & utf-8-fragment-on-decoding
Date: Wed, 4 Sep 2002 17:18:36 +0900 (JST)	[thread overview]
Message-ID: <200209040818.RAA12414@etlken.m17n.org> (raw)
In-Reply-To: <87y9aii9hc.fsf@cricket.magic.csuhayward.edu> (message from Thomas Morgan on 04 Sep 2002 01:56:15 -0400)

Thomas Morgan <tlm@pocketmail.com> writes:
> decode-char does not honor utf-8-fragment-on-decoding.
> I tried this code in
> GNU Emacs 21.3.50.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
> of 2002-09-03 on cricket
> run with options -q and --no-site-file.

>   (let ((utf-8-fragment-on-decoding nil)
>         (c ?Γ))
>     (= c (decode-char 'ucs (encode-char c 'ucs))))

> encode-char returns 915, decode-char returns 2883, and the entire sexp
> evalutes nil.  The Unicode code point is translated into greek-iso8859-7
> by decode-char even though utf-8-fragment-on-decoding is not enabled.

> Is this a bug?

The documetation of decode-char says that a character is
translated by utf-8-translation-table-for-decode (regardless
of utf-8-fragment-on-decoding).  Thus it's not a bug.  But,
I agree that this behavior is very confusing and not good.
And, I've recently found that utf-8 can't encode
cyrillic-iso8859-5 and greek-iso8859-7 correctly because of
this behavior.

> The following change makes decode-char act as I expected.

Thank you.  It seems to be the right fix.  I'll install it
soon.   Dave, do you see any problem with that?

---
Ken'ichi HANDA
handa@etl.go.jp

> *** /src/emacs/lisp/international/mule.el.~1.159.~	Sat Aug 24 03:46:25 2002
> --- /src/emacs/lisp/international/mule.el	Wed Sep  4 01:30:54 2002
> ***************
> *** 331,337 ****
>   	       (setq code-point (- code-point #xe000))
>   	       (make-char 'mule-unicode-e000-ffff
>   			  (+ (/ code-point 96) 32) (+ (% code-point 96) 32))))))
> !       (if (and c (aref utf-8-translation-table-for-decode c))
>   	  (aref utf-8-translation-table-for-decode c)
>   	c)))))
  
> --- 331,339 ----
>   	       (setq code-point (- code-point #xe000))
>   	       (make-char 'mule-unicode-e000-ffff
>   			  (+ (/ code-point 96) 32) (+ (% code-point 96) 32))))))
> !       (if (and c
> ! 	       utf-8-fragment-on-decoding
> ! 	       (aref utf-8-translation-table-for-decode c))
>   	  (aref utf-8-translation-table-for-decode c)
>   	c)))))
  

> Diff finished at Wed Sep  4 01:31:04



> _______________________________________________
> Bug-gnu-emacs mailing list
> Bug-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

  reply	other threads:[~2002-09-04  8:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-04  5:56 decode-char & utf-8-fragment-on-decoding Thomas Morgan
2002-09-04  8:18 ` Kenichi Handa [this message]
2002-09-04 23:34   ` Dave Love
2002-09-05  1:25     ` Kenichi Handa
2002-09-05 22:45       ` Dave Love
2002-09-05  5:23     ` Thomas Morgan
2002-09-05 22:47       ` Dave Love
2002-09-06  1:13         ` Thomas Morgan
2002-09-07 23:14           ` Dave Love
2002-09-08  1:07             ` Thomas Morgan
2002-09-09 22:35               ` Dave Love
  -- strict thread matches above, loose matches on Subject: below --
2002-09-05 17:39 Thomas Morgan
2002-09-05 22:50 ` Dave Love

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=200209040818.RAA12414@etlken.m17n.org \
    --to=handa@etl.go.jp \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=d.love@dl.ac.uk \
    /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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).