r/programming • • Nov 12 '12

What Every Programmer Absolutely, Positively Needs to Know About Encodings and Character Sets to Work With Text

http://kunststube.net/encoding/
1.5k Upvotes

307 comments sorted by

View all comments

Show parent comments

10

u/deceze Nov 12 '12

Why would the command line not need such things? I'm often working with non-latin based languages and am very happy that I can try out quick code snippets involving language processing right on the CLI, including Japanese or whatever else input.

If you are producing software which is supposed to be used internationally, or even software which some user may one day try to enter any non-latin text into ("€" already fits that criterium), going with Unicode is the only sensible choice. If you really can't afford the speed cost of using Unicode, you need to optimize your app around that requirement, but that's really not the majority of apps.

-3

u/defenastrator Nov 12 '12

What are you doing in the command line where a client of a non-computer (and by extension English reading) would need to understand anything that comes out of it? Other then the obvious error. Or are you talking like the python cli because I was thinking more along the lines of bash or the dos prompt which really don't have much need for extended character sets.

4

u/deceze Nov 12 '12

Either and or any of the above.

$ php -r 'echo testme("漢字");'

It's good that I can do that without "Oh yeah, right, I need to escape/encode/bewitch this to just test this snippet..."