bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: decode-char & utf-8-fragment-on-decoding


From: Kenichi Handa
Subject: Re: decode-char & utf-8-fragment-on-decoding
Date: Wed, 4 Sep 2002 17:18:36 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.1.30 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]