unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: John Mastro <john.b.mastro@gmail.com>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Is there a way to "asciify" a string?
Date: Sat, 02 Jun 2018 20:07:50 +0200	[thread overview]
Message-ID: <871sdp2hah.fsf@mbork.pl> (raw)
In-Reply-To: <CAOj2CQSJhkX5_ANjQ6w=p+5SE7RbE94w=iYNYD9h600K_ZRH9Q@mail.gmail.com>


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	other threads:[~2018-06-02 18:07 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27  6:22 Is there a way to "asciify" a string? Marcin Borkowski
2018-05-27  7:36 ` tomas
2018-05-27 12:36   ` Marcin Borkowski
2018-05-27 12:52     ` Teemu Likonen
2018-05-27 16:07       ` Eli Zaretskii
2018-05-27 16:59         ` Teemu Likonen
2018-05-28  5:24           ` Tak Kunihiro
2018-05-30 10:12           ` Marcin Borkowski
2018-05-30 17:05             ` Eli Zaretskii
2018-05-30 19:38               ` Marcin Borkowski
2018-05-27 20:00         ` tomas
2018-05-28 18:27           ` Eli Zaretskii
2018-05-29  6:37             ` tomas
2018-05-27 13:04     ` Yuri Khan
2018-05-30 10:14       ` Marcin Borkowski
2018-05-30 11:51         ` Yuri Khan
2018-05-30 15:04           ` Marcin Borkowski
2018-05-31  2:03       ` John Mastro
2018-06-02 18:07         ` Marcin Borkowski [this message]
2018-06-02 18:48           ` tomas
2018-06-07 17:16             ` Marcin Borkowski
2018-06-02 22:33           ` Drew Adams
2018-06-07 17:15             ` Marcin Borkowski
2018-06-02 18:12         ` Marcin Borkowski
2018-05-27 19:53     ` tomas
2018-05-28  8:15     ` Philipp Stephani
2018-05-28 10:28       ` Marcin Borkowski
2018-05-28 10:39         ` tomas
2018-05-28 15:30           ` Yuri Khan
2018-05-28 16:02             ` tomas
2018-05-30 10:12           ` Marcin Borkowski
2018-05-31 14:23     ` Stefan Monnier
2018-05-31 15:08       ` S. Champailler
2018-05-31 22:52         ` Richard Wordingham
2018-05-31 15:42       ` Marcin Borkowski
2018-05-31 15:53         ` Eli Zaretskii
2018-05-31 16:20           ` Yuri Khan
2018-05-31 19:03           ` Stefan Monnier
     [not found]       ` <mailman.871.1527781438.1292.help-gnu-emacs@gnu.org>
2018-05-31 23:23         ` James K. Lowden
2018-06-01  2:04           ` Stefan Monnier
2018-06-01  7:02           ` Eli Zaretskii
2018-05-27 14:55 ` Eric Abrahamsen
2018-05-27 16:00 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871sdp2hah.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=help-gnu-emacs@gnu.org \
    --cc=john.b.mastro@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).