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

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

Re: Is there a way to "asciify" a string?


From: Marcin Borkowski
Subject: Re: Is there a way to "asciify" a string?
Date: Sun, 27 May 2018 14:36:27 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2018-05-27, at 09:36, tomas@tuxteam.de wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sun, May 27, 2018 at 08:22:20AM +0200, Marcin Borkowski wrote:
>> Hi all,
>>
>> I want to convert e.g. "żółć" to "zolc", or "Poincaré" to "Poincare"
>> etc.  IOW, I want to replace all these funny Unicode accented characters
>> with their ASCII equivalents.
>>
>> Is there anything for that in Emacs?
>
> I haven't an answer to your direct question, just a warning: without a
> language context, you can't do it "correctly". For one illustrative
> example, in German "ü" -> "ue", but in Spanish "ü" -> "u" (those diaereses
> do have different functions in those languages). Transliterating "ü" with
> just "u" in German would be wrong (but the reader might make some sense
> of it), transliterating "ü" with "ue" in Spanish would not only be wrong,
> but would almost certainly throw off the reader's auto-correction feature
> (unles (s)he knows German and can recall that association).
>
> I'm sure there are tons of other examples like that.
>
> Heck, even up- and downcasing is strictly language context dependent
> (witness the Turkish dotless I).
>
> Sigh :-)

I understand that.

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).

At worst, I might just reimplement `tr' in Emacs and use it to convert
Polish letters to their Latin equivalents (which will cover 99.9%
cases), but I thought that with the (in)famous char folding etc. Emacs
can handle this out of the box.

(BTW, if there is some command-line utility to do that, that's fine
too.)

Best,

--
Marcin Borkowski
http://mbork.pl



reply via email to

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