[Top][All Lists]

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

Re: national to ASCII character conversion

From: Teemu Likonen
Subject: Re: national to ASCII character conversion
Date: Wed, 17 Jun 2009 21:26:24 GMT
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux)

On 2009-06-17 22:34 (+0200), Michal wrote:

> I have a string which contains national characters and I would like to
> convert them to ASCII equivalents.
> for example:
> ó -> o
> ł -> l
> ż -> z

I can't think of any simple and elegant way but using external tool
"iconv" is one solution. Put your string to a temporary buffer and
filter the buffer's content through iconv. A shell example:

    $ echo ółż | iconv -t ASCII//TRANSLIT

In Lisp it would be something like this:

    (setq my-string "ółż")

      (insert my-string)
      (shell-command-on-region (point-min) (point-max)
                               "/usr/bin/iconv -t ASCII//TRANSLIT"
                               (current-buffer) t)
      (setq my-string
            (buffer-substring-no-properties (point-min) (point-max))))

reply via email to

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