I have a large number of names, mostly using a German character set, i.e., ASCII plus ä,ö,ü,ß. Some names use special characters (e.g. ğ) which I would like to transliterate into the German version. So, "Özoğuz" should become "Özoguz".
I have tried
stri_trans_general("Özoğuz", "de-ASCII")
but that will result in "Oezoguz" not the desired "Özoguz".
The
de-ASCIIrule set translatesÖtoOe. If you want to deviate from this rule but otherwise maintain the German ASCII rule set, thestringidocs state that Custom rule-based transliteration is also supported.We can define rules which translate (upper and lower case)
Öto a third character, apply thede-ASCIIrules to everything else, then translates the third character back toÖ:I have used
"ℵ"and"ℶ"for upper and lower caseÖrespectively, but any utf-8 characters you are sure will not be in your string should work.