Re: Do I hate Unicode, or Do I Hate ASCII?
well, i usually code like this:
- all inputs are converted to unicode
- the internals of my programs only deal with unicode
- all the outputs are converted (explicitly) to byte-strings
at least this is what i'm trying ;)
there are generally 2 problems with this approach in python (it's much better in java for example):
- probably because of historical reasons (first there were byte-strings?) python kind-of recommends byte-strings...well, not exactly recommends..but..for example if you want to write an unicode string you have to prefix it with [u]. so it's usually extra work to enter unicode strings. in java this issue does not exists, because there the strings are unicode. there are no byte-strings (only byte-arrays)
- probably a consequence of #1: many library functions only deal with byte-strings. and what's worse, sometimes (to be sure) they start with somethings like "input = str(input)". and this of course completely fails when the input contains non-ascii... so you have to be careful...