Search code examples
smalltalkpharo

Smalltalk Unicode to ascii library


Is anyone aware of a smalltalk library for converting Unicode to ascii?

I'm hoping that it will be somewhat intelligent, i.e. remove diacritical marks. Non-ascii characters would either be removed or replace with something like an underscore. E.g.:

"ěščřžýáíé ❤"

would be converted to:

"escrzyaie _"

or:

"escrzyaie "

Thanks, Alistair


Solution

  • As was clarified in the comments, my goal was to be able to convert filenames containing non-ascii / non-printable characters into something that would still be meaningful but only contain ascii characters.

    Using the Diacritics library kindly pointed out by Peter I ended up writing a small class that does the conversion. If you're interested, it is at:

    https://github.com/akgrant43/AkgMiscellaneousUtilities/tree/master/mc/AKG-AsciiFilename.package

    Thanks for all the assistance!