all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: "Unidecode" functionality in Emacs
Date: Tue, 20 Mar 2018 08:39:10 +0200	[thread overview]
Message-ID: <83o9jjmesx.fsf@gnu.org> (raw)
In-Reply-To: <87bmfjgx55.fsf@iki.fi> (message from Teemu Likonen on Tue, 20 Mar 2018 06:59:34 +0200)

> From: Teemu Likonen <tlikonen@iki.fi>
> Date: Tue, 20 Mar 2018 06:59:34 +0200
> Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
> 
> I don't know of any built-in functions but external "iconv" tool can do
> similar thing for Latin scripts. Here's an example Emacs Lisp function
> wrapper for "iconv":
> 
>     (defun tl-ascii-translit (string)
>       (with-temp-buffer
>         (insert string)
>         (call-process-region (point-min) (point-max)
>                              "iconv" t t nil "-t" "ASCII//TRANSLIT")
>         (buffer-substring-no-properties (point-min) (point-max))))
> 
> Works for Latin scripts:
> 
>     (tl-ascii-translit "Déjà vu") ;=> "Deja vu"
>     (tl-ascii-translit "北亰") ;=> "??"

The iconv's "TRANSLIT" is not the transliteration that's sought here.
It's an attempt to present similarly-looking characters when the
original character is not in the target character set (ASCII in the
above snippet).  So it's a small wonder this only works for European
scripts, because no ASCII character can ever "look like" characters in
other scripts.



  reply	other threads:[~2018-03-20  6:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 22:04 "Unidecode" functionality in Emacs John Mastro
2018-03-20  4:59 ` Teemu Likonen
2018-03-20  6:39   ` Eli Zaretskii [this message]
2018-03-20  6:20 ` Eli Zaretskii
2018-03-20 17:23   ` John Mastro
2018-03-20 20:25   ` Stefan Monnier

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=83o9jjmesx.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.