[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to "asciify" a string?
From: |
Teemu Likonen |
Subject: |
Re: Is there a way to "asciify" a string? |
Date: |
Sun, 27 May 2018 15:52:58 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Marcin Borkowski [2018-05-27 14:36:27+02] wrote:
> Still, I need something *simple*. I have a person's name (possibly
> with some national characters), and I want to derive a filename from
> it. It doesn't have to be correct in 100% cases. It doesn't even have
> to be unambiguous (there will be a number for that in the filename,
> too).
> (BTW, if there is some command-line utility to do that, that's fine
> too.)
There is iconv:
$ echo áàãä | iconv -t ASCII//TRANSLIT
aaaa
So an Emacs Lisp wrapper function for iconv can be written like this:
(defun my-iconv-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))))
--
/// Teemu Likonen - .-.. <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///
signature.asc
Description: PGP signature
- Is there a way to "asciify" a string?, Marcin Borkowski, 2018/05/27
- Re: Is there a way to "asciify" a string?, tomas, 2018/05/27
- Re: Is there a way to "asciify" a string?, Marcin Borkowski, 2018/05/27
- Re: Is there a way to "asciify" a string?,
Teemu Likonen <=
- Re: Is there a way to "asciify" a string?, Eli Zaretskii, 2018/05/27
- Re: Is there a way to "asciify" a string?, Teemu Likonen, 2018/05/27
- Re: Is there a way to "asciify" a string?, Tak Kunihiro, 2018/05/28
- Re: Is there a way to "asciify" a string?, Marcin Borkowski, 2018/05/30
- Re: Is there a way to "asciify" a string?, Eli Zaretskii, 2018/05/30
- Re: Is there a way to "asciify" a string?, Marcin Borkowski, 2018/05/30
- Re: Is there a way to "asciify" a string?, tomas, 2018/05/27
- Re: Is there a way to "asciify" a string?, Eli Zaretskii, 2018/05/28
- Re: Is there a way to "asciify" a string?, tomas, 2018/05/29
- Re: Is there a way to "asciify" a string?, Yuri Khan, 2018/05/27