all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* multilingual text in frame
@ 2003-01-17 14:06 Phillip Lord
  2003-01-18 10:26 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Phillip Lord @ 2003-01-17 14:06 UTC (permalink / raw)





So I had this great idea. 

I thought what I would do is write some code that would display
phrases, and translations in two languages in the frame title of my
main emacs window. This I figured, over the weeks, would drip feed the
knowledge into my brain, thus enabling me to learn a new language. 

Now, Emacs being as wonderful as it is, I can, of course, easily
compose multilingual texts, which I have duly done. 

But here I am stymied. Although Emacs can display text such as "?Qui
es esto?" in the buffer fine, it has a much harder time in the frame,
and appears to chop everything off, after the strange character.

So, two questions

1) Is it possible to do mule like things in the frame title? 
2) if it is not, can I remove accented letters from a string, replacing
   them with their non accented equivalent, and strip strange
   punctuation marks altogether. This will enable me to keep a library
   of correctly accented phrases for display in the mini-buffer, and
   still have them display on the frame.

It would be sad for me, having gone to all the effort of reading the
documentation on how to input non ASCII characters, to not use them!

Cheers

Phil

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

* Re: multilingual text in frame
  2003-01-17 14:06 multilingual text in frame Phillip Lord
@ 2003-01-18 10:26 ` Eli Zaretskii
  2003-01-18 18:35 ` Jesper Harder
       [not found] ` <mailman.524.1042889362.21513.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2003-01-18 10:26 UTC (permalink / raw)


> From: Phillip Lord <p.lord@russet.org.uk>
> Newsgroups: gnu.emacs.help
> Date: 17 Jan 2003 14:06:52 +0000
> 
> 1) Is it possible to do mule like things in the frame title? 

I think non-ASCII characters in frame titles and in the mode line
should be possible, but there are a few bugs there.  Please report
this as a bug, and hopefully someone will either tell you how to fix
that or fix it in a future release.

Thanks.

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

* Re: multilingual text in frame
  2003-01-17 14:06 multilingual text in frame Phillip Lord
  2003-01-18 10:26 ` Eli Zaretskii
@ 2003-01-18 18:35 ` Jesper Harder
  2003-01-20 12:50   ` Phillip Lord
       [not found] ` <mailman.524.1042889362.21513.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 14+ messages in thread
From: Jesper Harder @ 2003-01-18 18:35 UTC (permalink / raw)


Phillip Lord <p.lord@russet.org.uk> writes:

> But here I am stymied. Although Emacs can display text such as "?Qui
> es esto?" in the buffer fine, it has a much harder time in the frame,
> and appears to chop everything off, after the strange character.

Are you running Emacs under X11?  If so, what's your locale?

I can display Latin-1 (my locale) characters in the frame title just
fine.  But characters from other charsets don't work.  

I haven't tried, but I suspect that if I changed my locale to, say,
Greek then Greek characters would work.

There's also an X resource, 'titleEncoding', which is supposed to say
which encoding is used in the title -- but Emacs seems to ignore that.

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

* Re: multilingual text in frame
  2003-01-18 18:35 ` Jesper Harder
@ 2003-01-20 12:50   ` Phillip Lord
  0 siblings, 0 replies; 14+ messages in thread
From: Phillip Lord @ 2003-01-20 12:50 UTC (permalink / raw)


>>>>> "Jesper" == Jesper Harder <harder@myrealbox.com> writes:

  Jesper> Phillip Lord <p.lord@russet.org.uk> writes:

  >> But here I am stymied. Although Emacs can display text such as
  >> "?Qui es esto?" in the buffer fine, it has a much harder time in
  >> the frame, and appears to chop everything off, after the strange
  >> character.

  Jesper> Are you running Emacs under X11?  If so, what's your locale?

  Jesper> I can display Latin-1 (my locale) characters in the frame
  Jesper> title just fine.  But characters from other charsets don't
  Jesper> work.


Not sure, but probably English_GB, or some such. The problem is that I
want to be able to display text that is not in the same language as
the "background" locale. 


Cheers

Phil

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

* Re: multilingual text in frame
       [not found] ` <mailman.524.1042889362.21513.help-gnu-emacs@gnu.org>
@ 2003-01-20 12:50   ` Phillip Lord
  2003-01-20 15:44     ` Ehud Karni
  0 siblings, 1 reply; 14+ messages in thread
From: Phillip Lord @ 2003-01-20 12:50 UTC (permalink / raw)


>>>>> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes:

  >> From: Phillip Lord <p.lord@russet.org.uk> Newsgroups:
  >> gnu.emacs.help Date: 17 Jan 2003 14:06:52 +0000
  >>
  >> 1) Is it possible to do mule like things in the frame title?

  Eli> I think non-ASCII characters in frame titles and in the mode
  Eli> line should be possible, but there are a few bugs there.
  Eli> Please report this as a bug, and hopefully someone will either
  Eli> tell you how to fix that or fix it in a future release.

I'll do that.

Cheers

Phil

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

* Re: multilingual text in frame
  2003-01-20 12:50   ` Phillip Lord
@ 2003-01-20 15:44     ` Ehud Karni
  2003-01-20 18:34       ` Eli Zaretskii
                         ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Ehud Karni @ 2003-01-20 15:44 UTC (permalink / raw)
  Cc: Handa Kenichi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 20 Jan 2003 12:50:53 +0000, Phillip Lord <p.lord@russet.org.uk> wrote:
>
> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes:
>
>   >> 1) Is it possible to do mule like things in the frame title?
>
>   Eli> I think non-ASCII characters in frame titles and in the mode
>   Eli> line should be possible, but there are a few bugs there.
>   Eli> Please report this as a bug, and hopefully someone will either
>   Eli> tell you how to fix that or fix it in a future release.

I checked it with Hebrew (MULE, iso-8859-8) and this is what I found:
  1. The mode line display the Hebrew OK.
  2. The frame title has the Hebrew characters in it, but it is not
     displayed (presumably because it has the MULE values instead of
     the unibyte values).
     If I change the title to unibyte string with:
         (modify-frame-parameters (selected-frame) (list (cons
                'title (multibyte-string-to-unibyte "ינרק דוהא on Beta"))))
     I can see the Hebrew characters but in Latin-1 (?) glyphs.
     I conclude that the font of the frame title (and frame icon) is not
     a font from the fontset I'm using for the frame. I don't know how
     to set this font.

Ehud.

I defined a function `multibyte-string-to-unibyte', it converts each
character in the input string by using `multibyte-char-to-unibyte'.
I think it should be a built-in (C) function.


- --
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+LBlULFvTvpjqOY0RAnxBAJ9FaKphoJKoKfTxLHgcFUNmPjS+WACfffTi
uGTPsODd1ao0gEsQw9FG8Hs=
=S6Mo
-----END PGP SIGNATURE-----

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

* Re: multilingual text in frame
  2003-01-20 15:44     ` Ehud Karni
@ 2003-01-20 18:34       ` Eli Zaretskii
  2003-01-20 20:28         ` Ehud Karni
  2003-01-21 11:46       ` Kenichi Handa
       [not found]       ` <mailman.673.1043149750.21513.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2003-01-20 18:34 UTC (permalink / raw)
  Cc: p.lord

> Date: Mon, 20 Jan 2003 17:44:20 +0200
> From: "Ehud Karni" <ehud@unix.mvs.co.il>
> 
> I defined a function `multibyte-string-to-unibyte', it converts each
> character in the input string by using `multibyte-char-to-unibyte'.
> I think it should be a built-in (C) function.

Why didn't you simply use encode-coding-string?  It _is_ a built-in
primitive.

(IMHO, one should stay away of the multibyte <-> unibyte conversion
functions such as multibyte-char-to-unibyte, since the decisions they
make about how to encode/decode characters are very complex and hard
to explain and remember.  By contrast, explicit encoding functions let
you specify the encoding, so you are the boss ;-)

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

* Re: multilingual text in frame
  2003-01-20 18:34       ` Eli Zaretskii
@ 2003-01-20 20:28         ` Ehud Karni
  2003-01-20 20:28           ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Ehud Karni @ 2003-01-20 20:28 UTC (permalink / raw)
  Cc: p.lord

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 20 Jan 2003 21:34:35 +0300, Eli Zaretskii <eliz@is.elta.co.il> wrote:
>
> Why didn't you simply use encode-coding-string?  It _is_ a built-in
> primitive.

You are right. using
    (encode-coding-string "ינרק דוהא on Beta" 'hebrew-iso-8bit)
gives the same result.

But if (by mistake) I do:
    (encode-coding-string "ינרק דוהא on Beta" 'iso-latin-1)
I get:  "^[,Hipxw^[(B ^[,Hced`^[(B on Beta"
which is wrong for me (it includes Escape sequences that are bad
for my unibyte - wrong number of characters).

With multibyte to unibyte - I may get a wrong character (if it is
not in my charset) but I get the number of characters right.

Ehud.


- --
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni                       ינרק דוהא
     @    @      @  @@  @   Senior System Support   בשחמ תוכרעמב הכימת
     @    @ @    @ @  @@    Mivtach - Simon               ןומיס - חטבמ
     @    @ @    @ @    @   Insurance agencies          חוטבל תויונכוס
  Better Safe Than Sorry    Tel: +972-3-7966-561  Fax: +972-3-7966-667
   http://www.mvs.co.il             mailto:ehud@unix.mvs.co.il

 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+LFvTLFvTvpjqOY0RAryLAJwLFOSm7bZp/d2gN97OZPeFJe/ycACgipEt
fjYQAlXIYuuzpr8KqUOksas=
=ifs7
-----END PGP SIGNATURE-----

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

* Re: multilingual text in frame
  2003-01-20 20:28         ` Ehud Karni
@ 2003-01-20 20:28           ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2003-01-20 20:28 UTC (permalink / raw)
  Cc: p.lord

> Date: Mon, 20 Jan 2003 22:28:03 +0200
> From: "Ehud Karni" <ehud@unix.mvs.co.il>
> 
> I get:  "^[,Hipxw^[(B ^[,Hced`^[(B on Beta"
> which is wrong for me (it includes Escape sequences that are bad
> for my unibyte - wrong number of characters).

There's no reason you should make such mistakes ;-)

Anyway, the fact that it's possible to make a mistake when specifying
arguments to a function does not necessarily mean that a function that
guesses those arguments is better.

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

* Re: multilingual text in frame
  2003-01-20 15:44     ` Ehud Karni
  2003-01-20 18:34       ` Eli Zaretskii
@ 2003-01-21 11:46       ` Kenichi Handa
  2003-01-21 18:06         ` Ehud Karni
       [not found]       ` <mailman.673.1043149750.21513.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 14+ messages in thread
From: Kenichi Handa @ 2003-01-21 11:46 UTC (permalink / raw)
  Cc: p.lord

In article <200301201544.h0KFiKIK012501@beta.mvs.co.il>, "Ehud Karni" <ehud@unix.mvs.co.il> writes:
> I defined a function `multibyte-string-to-unibyte', it converts each
> character in the input string by using `multibyte-char-to-unibyte'.
> I think it should be a built-in (C) function.

How is it different from string-make-unibyte?

---
Ken'ichi HANDA
handa@m17n.org

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

* Re: multilingual text in frame
       [not found]       ` <mailman.673.1043149750.21513.help-gnu-emacs@gnu.org>
@ 2003-01-21 17:57         ` Stefan Monnier <foo@acm.com>
  0 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2003-01-21 17:57 UTC (permalink / raw)


>> I defined a function `multibyte-string-to-unibyte', it converts each
>> character in the input string by using `multibyte-char-to-unibyte'.
>> I think it should be a built-in (C) function.

I think that multibyte-char-to-unibyte and its friends like
string-make-unibyte should be avoided as much as possible.
In most cases, they're only used because the author doesn't really
understand what he's doing (I don't know if that's the case here,
because I only saw Kenichi's reply but not the original post).

Better use something like (encode-coding-string str locale-coding-system)
so it's clear which coding-system is being used.


        Stefan

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

* Re: multilingual text in frame
  2003-01-21 11:46       ` Kenichi Handa
@ 2003-01-21 18:06         ` Ehud Karni
  0 siblings, 0 replies; 14+ messages in thread
From: Ehud Karni @ 2003-01-21 18:06 UTC (permalink / raw)
  Cc: p.lord

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 21 Jan 2003 20:46:43 +0900 (JST), Kenichi Handa <handa@m17n.org> wrote:
> 
> In article <200301201544.h0KFiKIK012501@beta.mvs.co.il>, "Ehud Karni" <ehud@unix.mvs.co.il> writes:
> > I defined a function `multibyte-string-to-unibyte', it converts each
> > character in the input string by using `multibyte-char-to-unibyte'.
> > I think it should be a built-in (C) function.
> 
> How is it different from string-make-unibyte?

The `string-make-unibyte' takes the lower 8 bits, the
`multibyte-string-to-unibyte' sets the value according to the current
coding system. e.g. Hebrew Kof (0xc77 in MULE for iso-8859-8) will be
0x77 by `string-make-unibyte' and 0xF7 by my function.

As Eli pointed out, my function works like `decode-coding-string' with
the current coding system.

Ehud.


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+LYwULFvTvpjqOY0RAv7kAJ9YxL01pGyykJ+uhgRFkzezfaH7YgCgi4u7
8ndn35BsVbasK3qwdtuknPo=
=xrhQ
-----END PGP SIGNATURE-----

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

* Re: multilingual text in frame
       [not found] <E18abYP-0004xd-00@gannet.scg.man.ac.uk>
@ 2003-01-21 18:18 ` Richard Stallman
  2003-01-22 12:16   ` Phillip Lord
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Stallman @ 2003-01-21 18:18 UTC (permalink / raw)
  Cc: emacs-devel

    So for instance I can display "?Que' es esto?" fine in the buffer
    (with an upside down ?, and an "e acute" which won't go through the
    mail system), but if I try to display it on the frame title, it gets
    truncated after the first ascii character.

    I'm not sure whether emacs should be able to do this, or not, so I
    don't know whether this is a bug, or not!

In principle, the failure to handle multilingual text in any context
is a bug.  There is code in x_set_name (xfns.c) to encode non-ASCII
chars in the coding system compound-text.  Could you investigate
why this feature does not work?

    On a separate front, any advice, as to how to strip non ascii
    characters, or rather translate them to return something equivalent
    (so "e acute" would return "e" and so on), which I could use as a work
    around, would be much appreciated. 

I don't think we have anything like this.  We could add it if someone
implements it.

It might be useful in menus, as long as menus can't fully handle
non-ASCII chars.

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

* Re: multilingual text in frame
  2003-01-21 18:18 ` Richard Stallman
@ 2003-01-22 12:16   ` Phillip Lord
  0 siblings, 0 replies; 14+ messages in thread
From: Phillip Lord @ 2003-01-22 12:16 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "Richard" == Richard Stallman <rms@gnu.org> writes:

  Phil>     So for instance I can display "?Que' es esto?" fine in
  Phil>     the buffer (with an upside down ?, and an "e acute"
  Phil>     which won't go through the mail system), but if I try
  Phil>     to display it on the frame title, it gets truncated
  Phil>     after the first ascii character.
  
  Phil>     I'm not sure whether emacs should be able to do this,
  Phil>     or not, so I don't know whether this is a bug, or not!

  Richard> In principle, the failure to handle multilingual text in
  Richard> any context is a bug.  There is code in x_set_name (xfns.c)
  Richard> to encode non-ASCII chars in the coding system
  Richard> compound-text.  Could you investigate why this feature does
  Richard> not work?

I'm afraid I'm only really competent to debug lisp. I've never written
C in anger, or used any of the tools. 

  Phil>     On a separate front, any advice, as to how to strip non
  Phil>     ascii characters, or rather translate them to return
  Phil>     something equivalent (so "e acute" would return "e" and
  Phil>     so on), which I could use as a work around, would be
  Phil>     much appreciated.

  Richard> I don't think we have anything like this.  We could add it
  Richard> if someone implements it.

  Richard> It might be useful in menus, as long as menus can't fully
  Richard> handle non-ASCII chars.


I'll think about having a go at this. 

Phil

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

end of thread, other threads:[~2003-01-22 12:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-17 14:06 multilingual text in frame Phillip Lord
2003-01-18 10:26 ` Eli Zaretskii
2003-01-18 18:35 ` Jesper Harder
2003-01-20 12:50   ` Phillip Lord
     [not found] ` <mailman.524.1042889362.21513.help-gnu-emacs@gnu.org>
2003-01-20 12:50   ` Phillip Lord
2003-01-20 15:44     ` Ehud Karni
2003-01-20 18:34       ` Eli Zaretskii
2003-01-20 20:28         ` Ehud Karni
2003-01-20 20:28           ` Eli Zaretskii
2003-01-21 11:46       ` Kenichi Handa
2003-01-21 18:06         ` Ehud Karni
     [not found]       ` <mailman.673.1043149750.21513.help-gnu-emacs@gnu.org>
2003-01-21 17:57         ` Stefan Monnier <foo@acm.com>
     [not found] <E18abYP-0004xd-00@gannet.scg.man.ac.uk>
2003-01-21 18:18 ` Richard Stallman
2003-01-22 12:16   ` Phillip Lord

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.