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: Sat, 02 Jun 2018 20:07:50 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2018-05-31, at 04:03, John Mastro <john.b.mastro@gmail.com> wrote:

> Yuri Khan <yurivkhan@gmail.com> wrote:
>> > 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).
>>
>> Technically you could use the name of a person as is, as long as it is
>> representable in Unicode and contains neither the null character nor the
>> slash character. But I assume you want a filename that is portable between
>> file systems, or a filename that can be represented in an URI path segment
>> without %-encoding, or any combination of the above.
>>
>> In that case, the Python unidecode library is probably the closest that you
>> can find. But make very sure that the people involved never see their own
>> name’s transliteration.
>
> There's also an Emacs Lisp port of unidecode[1]
>
> (unidecode "żółć")
> ;=> "zolc"
>
> [1]: https://github.com/sindikat/unidecode

Thanks,

and thanks also to all the others for their input.

I didn't really intend to create such a storm.

My use case is much, much simpler than much of the stuff mentioned in
this thread.  99.5% (or more) of the cases are Polish names, where we
have only 9 "offending" letters, all easily asciified.  I thought there
is a simple, general solution (and I learned there isn't and probably
there can't be).

Hence, I'm going to stick with Eli's suggestion (and manual conversion
of "ł" into "l").  And in case I encounter a non-Polish name with some
letters outside the English alphabet (this may very rarely happen),
I can just manually override this simple solution.

IOW, KISS.

But thanks for the opportunity to learn a few things!

--
Marcin Borkowski
http://mbork.pl



reply via email to

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