This doesn't work when using unicode characters (in Ubuntu bash):
$ perl -pC -e's/[à]/a/gu' <<< 'à'
à
$ perl -pC -e's/[b]/a/gu' <<< 'b'
a
Even though it seems to be supported by PCRE (at least according to regex101).
What am I doing wrong? Am I missing some flag in the perl command?
This "just works" in javascript, so I would be using node if I could come up with a simple one-liner for this in command line ... but I still want to know why the perl command is not working.
For context:
I'm trying to use substitutions like /[àâáãä]/a/g, /[òôóõö]/o/g, etc to asciify a dictionary file (i.e. remove accents, etc. of a word list), so I can use it to make spell-checking accent-insensitive (e.g. in IntelliJ Idea).
Basically these are the steps to make an "asciified" extra dictionary:
- Download the .dic file for the language (list of all words)
- Use grep to filter words containing non-ascii / replaceable characters
- Use regex substitutions in succession to make words accent-insensitive
- Import the asciified .dic file in the IDE (in addition to the standard language dictionary)