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

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

Re: "Unidecode" functionality in Emacs


From: Eli Zaretskii
Subject: Re: "Unidecode" functionality in Emacs
Date: Tue, 20 Mar 2018 08:39:10 +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 via email to

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