all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joe Corneli <jcorneli@math.utexas.edu>
Subject: Re: making "&#29572;&#22872;" say "Xuanzang" in chinese
Date: Thu, 24 Mar 2005 19:07:40 -0600	[thread overview]
Message-ID: <E1DEdIa-0002j7-00@lab45.ma.utexas.edu> (raw)
In-Reply-To: <87r7i46c4z.fsf@tc-1-100.kawasaki.gol.ne.jp> (message from Miles Bader on Fri, 25 Mar 2005 05:07:40 +0900)


   Joe Corneli <jcorneli@math.utexas.edu> writes:
   > Adapted from w3m-filter.el:
   >
   > (while (re-search-forward "&#\\([0-9]+\\);" nil t)
   >   (setq ucs (string-to-number (match-string 1)))
   >   (delete-region (match-beginning 0) (match-end 0))
   >   (insert-char ucs 1))
   >
   > This would appear to work if the characters themselves were recognized...
   >
   > But when I run this expression on a buffer containing the string
   > "&#29572;&#22872;" what I get is an error, like this:

   Is that really what w3m does?

Hm... well I did doctor it up a bit.  In particular, I took out some
code that wrapped `ucs' in the last line with the function defined by:

 (defun w3m-ucs-to-char (codepoint)
   (or (decode-char 'ucs codepoint) ?~))

But keeping the function around wasn't helping either.  Except, when I
tried it again, it worked, so I must have gotten something wrong.

This code seems a little more readable than the code you
supplied...  but they seem to have the same effect.

Anyway, your advice got me past whatever I was stumbling over.

Can you suggest something that will work on this content from the
gnu.org homepage?  Neither the w3m code nor your code seems to produce
human readable output on this stuff (maybe I'm missing some fonts or
something?).  I get a bunch of control-at characters... (oh yeah,
after modifying the "[0-9]" to be ".....".

  [ Az@rbaycanca | Bahasa Indonesia | Bosanski | Catal`
  | &#x7b80;&#x4f53;&#x4e2d;&#x6587; |
  &#x7e41;&#x9ad4;&#x4e2d;&#x6587; | Cesky | Dansk |
  Deutsch | English | Ellynika' | Espaqol | Frangais
  | Hrvatski | Italiano | E+B+R+J+T+ |
  &#x65e5;&#x672c;&#x8a9e; | &#xd55c;&#xad6d;&#xc5b4; |
  Magyar | Nederlands | Norsk | Polski | Portugujs |
  Rombna | Russkij | Srpski | Shqip | Suomi |
  Svenska | Tagalog |
  &#x0e20;&#x0e32;&#x0e29;&#x0e32;&#x0e44;&#x0e17;&#x0e22; |
  T|rkge | Tie>'ng Vie>-.t | Ukrayins'ka ]

  reply	other threads:[~2005-03-25  1:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-23  3:14 making "&#29572;&#22872;" say "Xuanzang" in chinese Joe Corneli
2005-03-23 13:08 ` Mark Plaksin
2005-03-23 15:56   ` Joe Corneli
2005-03-23 16:29   ` Joe Corneli
     [not found]   ` <mailman.20.1111596532.28103.help-gnu-emacs@gnu.org>
2005-03-24 20:07     ` Miles Bader
2005-03-25  1:07       ` Joe Corneli [this message]
2005-03-25  2:16         ` Miles Bader

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=E1DEdIa-0002j7-00@lab45.ma.utexas.edu \
    --to=jcorneli@math.utexas.edu \
    /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 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.