How to make locale aware uppercase operation?
Standard tr ‘[:lower:]’ ‘[:upper:]’ trick doesn’t work:
=$ echo żółw | tr "[:lower:]" "[:upper:]"
żółW
(it should be ŻÓŁW)
I’d rather avoid having to run Perl or anything such heavy-weight.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems to me that if you want to avoid a heavyweight you’d need to provide the characters yourself, and, given that’s a nonstarter for a truly generic solution, you are stuck with using a heavyweight.
One heavyweight solution
Non-heavyweight solution that would require you to specify each character
EDIT: Based on the other answer and comments, BASH 4.0 IS locale sensitive and aware of wide chars. You have to set a proper locale of course (LC_CTYPE or LC_ALL) so BASH can tell what it is supposed to do. Also it seems that there are locale sensitive versions of tr as of late (for example, Mac OSX 10.6)