all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs, Chinese language environment, and Japanese fonts
@ 2005-09-14 20:59 Romain Francoise
  2005-09-15  2:34 ` Kenichi Handa
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Francoise @ 2005-09-14 20:59 UTC (permalink / raw)


I received a bug report from a Chinese user complaining that Emacs 22
wants to use a Japanese font to display a character from the Chinese
alphabet, even if the language environment is set to something Chinese
(in this case, Chinese-GB).

My guess is that the character is identical in Chinese and Japanese
(kanji) alphabets and that Emacs just uses the "best fitting" font,
which isn't installed on this user's workstation.  Apparently,
(list-charset-chars 'chinese-gb2312) correctly shows the character, but
the font isn't selected when displaying a regular buffer.

Is that a bug or a configuration problem?  I'm not really knowledgeable
about this stuff, can someone enlighten me?

You can find more information here:

    <URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=328196>

Thanks,

-- 
Romain Francoise <romain@orebokech.com> | I like the streets when
it's a miracle -- http://orebokech.com/ | they're empty, I can make the
                                        | rest up.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs, Chinese language environment, and Japanese fonts
  2005-09-14 20:59 Emacs, Chinese language environment, and Japanese fonts Romain Francoise
@ 2005-09-15  2:34 ` Kenichi Handa
  2005-09-15  2:54   ` LI Daobing
  0 siblings, 1 reply; 6+ messages in thread
From: Kenichi Handa @ 2005-09-15  2:34 UTC (permalink / raw)
  Cc: lidaobing, emacs-devel

In article <87psrb9xhj.fsf@pacem.orebokech.com>, Romain Francoise <romain@orebokech.com> writes:

> I received a bug report from a Chinese user complaining that Emacs 22
> wants to use a Japanese font to display a character from the Chinese
> alphabet, even if the language environment is set to something Chinese
> (in this case, Chinese-GB).

> My guess is that the character is identical in Chinese and Japanese
> (kanji) alphabets and that Emacs just uses the "best fitting" font,
> which isn't installed on this user's workstation.  Apparently,
> (list-charset-chars 'chinese-gb2312) correctly shows the character, but
> the font isn't selected when displaying a regular buffer.

> Is that a bug or a configuration problem?  I'm not really knowledgeable
> about this stuff, can someone enlighten me?

> You can find more information here:

>     <URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=328196>

I've just read that thread.  In any Chinese-XXX lang. env.,
if that character is (0x4A4A of GB2312) encoded in UTF-8,
Emacs correctly decodes it into chinese-gb charset.  So, my
question is how he got that character in Emacs buffer.  One
possibility is that he cut&pasted it from the other
application and that application sent that character encoded
in compound-text while designating JISX0212.  In that case,
Emacs surely decodes it into japanese-jisx0212, but that is
a correct behaviour.

(setq x-select-request-type '(UTF8_STRING COMPOUND-TEXT))

forces Emacs to ask the other application to send a
selection data in utf-8 if possible.   So, this setting will
work for him.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs, Chinese language environment, and Japanese fonts
  2005-09-15  2:34 ` Kenichi Handa
@ 2005-09-15  2:54   ` LI Daobing
  2005-09-15  3:52     ` Kenichi Handa
  0 siblings, 1 reply; 6+ messages in thread
From: LI Daobing @ 2005-09-15  2:54 UTC (permalink / raw)
  Cc: Romain Francoise, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]

On 9/15/05, Kenichi Handa <handa@m17n.org> wrote:
> In article <87psrb9xhj.fsf@pacem.orebokech.com>, Romain Francoise <romain@orebokech.com> writes:
> 
> > I received a bug report from a Chinese user complaining that Emacs 22
> > wants to use a Japanese font to display a character from the Chinese
> > alphabet, even if the language environment is set to something Chinese
> > (in this case, Chinese-GB).
> 
> > My guess is that the character is identical in Chinese and Japanese
> > (kanji) alphabets and that Emacs just uses the "best fitting" font,
> > which isn't installed on this user's workstation.  Apparently,
> > (list-charset-chars 'chinese-gb2312) correctly shows the character, but
> > the font isn't selected when displaying a regular buffer.
> 
> > Is that a bug or a configuration problem?  I'm not really knowledgeable
> > about this stuff, can someone enlighten me?
> 
> > You can find more information here:
> 
> >     <URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=328196>
> 
> I've just read that thread.  In any Chinese-XXX lang. env.,
> if that character is (0x4A4A of GB2312) encoded in UTF-8,
> Emacs correctly decodes it into chinese-gb charset.  So, my
> question is how he got that character in Emacs buffer.  One
> possibility is that he cut&pasted it from the other
> application and that application sent that character encoded
> in compound-text while designating JISX0212.  In that case,
> Emacs surely decodes it into japanese-jisx0212, but that is
> a correct behaviour.
> 
> (setq x-select-request-type '(UTF8_STRING COMPOUND-TEXT))
> 
> forces Emacs to ask the other application to send a
> selection data in utf-8 if possible.   So, this setting will
> work for him.
> 

I am very glad to reproduce this bug to you:

my env:
locale: LANG=en_US.UTF-8
emacs-snapshot: emacs-snapshot-gtk in debian version 1:20050908-1

i use 'emacs-snapshot -q' to start emacs, open a new file, input "适",
save it, use 'C-u C-x =' to get the char info, this is the result:

  character: 适 (0270313, 94411, 0x170cb, U+9002)
    charset: [japanese-jisx0212] (JISX0212 Japanese supplement: ISO-IR-159.)
 code point: [97 75]
     syntax: w 	which means: word
   category: C:Chinese (Han) characters of 2-byte character sets   j:Japanese  
	     |:While filling, we can break a line at this character.  
buffer code: 0x94 0xE1 0xCB
  file code: 0xE9 0x80 0x82 (encoded by coding system mule-utf-8)
    display: by this font (glyph code)
     -Misc-Fixed-Medium-R-Normal--16-150-75-75-C-160-JISX0212.1990-0 (0x614B)

if i use 'emacs-snapshot -q -no-site-file' to open emacs, and open the
file contain that char(it seems i can't input that char with a clean
emacs), I got the same result.

Thanks

-- 
LI Daobing

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs, Chinese language environment, and Japanese fonts
  2005-09-15  2:54   ` LI Daobing
@ 2005-09-15  3:52     ` Kenichi Handa
  2005-09-15  4:25       ` Kenichi Handa
  0 siblings, 1 reply; 6+ messages in thread
From: Kenichi Handa @ 2005-09-15  3:52 UTC (permalink / raw)
  Cc: romain, emacs-devel

In article <8eae5a660509141954430abc8f@mail.gmail.com>, LI Daobing <lidaobing@gmail.com> writes:
> I am very glad to reproduce this bug to you:

> my env:
> locale: LANG=en_US.UTF-8
> emacs-snapshot: emacs-snapshot-gtk in debian version 1:20050908-1

As your locale is en_US.UTF-8, Emacs doen't know to which
charset to decode that character from UTF-8.  The default is
to prefer JIS.  If you prefer Chinese, why don't you use, for
instance, zh_CN.UTF-8?

By the way, you wrote:

> I prefer it is bug, becase this bug still happen even when I use
> (set-language-environment "Chinese-GB").

You must change the lang. env. before you read a
UTF-8 file.  Have you tried it?

I agree that it's not good that saving and reading with the
same coding system doesn't give you the same character.
But, that is the limitation of the current Emacs, and can't
be solved easily.  If you really have to be in English
language environment but prefer Chinese, please try this in
your .emacs.

(set-language-environment "Chinese-GB")
(set-language-environment "English")

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs, Chinese language environment, and Japanese fonts
  2005-09-15  3:52     ` Kenichi Handa
@ 2005-09-15  4:25       ` Kenichi Handa
  2005-09-15  4:47         ` LI Daobing
  0 siblings, 1 reply; 6+ messages in thread
From: Kenichi Handa @ 2005-09-15  4:25 UTC (permalink / raw)
  Cc: lidaobing, romain, emacs-devel

In article <E1EFknc-0000vv-00@etlken>, Kenichi Handa <handa@m17n.org> writes:

> If you really have to be in English language environment
> but prefer Chinese, please try this in your .emacs.

> (set-language-environment "Chinese-GB")
> (set-language-environment "English")

Oops, it should be:

(set-language-environment "Chinese-GB")
(utf-translate-cjk-load-tables)
(set-language-environment "English")

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs, Chinese language environment, and Japanese fonts
  2005-09-15  4:25       ` Kenichi Handa
@ 2005-09-15  4:47         ` LI Daobing
  0 siblings, 0 replies; 6+ messages in thread
From: LI Daobing @ 2005-09-15  4:47 UTC (permalink / raw)
  Cc: romain, emacs-devel

On 9/15/05, Kenichi Handa <handa@m17n.org> wrote:
> In article <E1EFknc-0000vv-00@etlken>, Kenichi Handa <handa@m17n.org> writes:
> 
> > If you really have to be in English language environment
> > but prefer Chinese, please try this in your .emacs.
> 
> > (set-language-environment "Chinese-GB")
> > (set-language-environment "English")
> 
> Oops, it should be:
> 
> (set-language-environment "Chinese-GB")
> (utf-translate-cjk-load-tables)
> (set-language-environment "English")
> 
It seems this one is very sensitive to locale, I got different result
under locale zh_CN, zh_TW, ja_JP, ko_KR,and not sensitive to
set-language-environment.

I think I can solve my problem by
export LANG=en_US.UTF-8
export LC_CTYPE=zh_CN.UTF-8

Thanks.


-- 
LI Daobing

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-09-15  4:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-14 20:59 Emacs, Chinese language environment, and Japanese fonts Romain Francoise
2005-09-15  2:34 ` Kenichi Handa
2005-09-15  2:54   ` LI Daobing
2005-09-15  3:52     ` Kenichi Handa
2005-09-15  4:25       ` Kenichi Handa
2005-09-15  4:47         ` LI Daobing

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.