I have this:
>>> print 'example' example >>> print 'exámple' exámple >>> print 'exámple'.upper() EXáMPLE
What I need to do to print:
EXÁMPLE
(Where the 'a' gets its accute accent, but in uppercase.)
I'm using Python 2.6.
We can put the Unicode value with the prefix \u. Thus we can successfully print the Unicode character.
You CAN'T convert from Unicode to ASCII. Almost every character in Unicode cannot be expressed in ASCII, and those that can be expressed have exactly the same codepoints in ASCII as in UTF-8, which is probably what you have.
In Python, the built-in functions chr() and ord() are used to convert between Unicode code points and characters. A character can also be represented by writing a hexadecimal Unicode code point with \x , \u , or \U in a string literal.
I think it's as simple as not converting to ASCII first.
>>> print u'exámple'.upper() EXÁMPLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With