which command in linux can convert my name into username like:
name :Lê Thành Việt
--> convert to: le.thanh.viet ( not lê.thành.việt )
Asked
Active
Viewed 118 times
1 Answers
1
echo "Lê Thành Việt" | iconv -f UTF-8 -t ascii//TRANSLIT | tr ' ' '.' | tr '[:upper:]' '[:lower:]'
-
I tested this on Darwin and on OpenBSD (because I've thought about _similar_ problems). On OpenBSD it works, but on Darwin I get `iconv: (stdin):1:11: cannot convert` followed by the result `l^e.th``anh.vit`... – Kusalananda Jun 16 '16 at 06:06
-
@Kusalananda probably you need to read the manuals for the iconv utility for Darwin. – Yuri G. Jun 16 '16 at 06:07
-
I was actually on a Linux system when it worked, on OpenBSD it doesn't. I need to remember where I'm logged in! (note to self: put host name in `$PS1`). The manuals are identical on all three systems. – Kusalananda Jun 16 '16 at 06:13
-
@Kusalananda I have no clue why it doesn't work on OpenBSD and Darwin, may be there is some difference in utf8 decoding. I think you can open another question and tag it with OpenBSD and Darwin tags – Yuri G. Jun 16 '16 at 06:20