Re: [Python-Dev] Shouldn't I be able to print Unicode objects?
Skip Montanaro
Just catching up on a little c.l.py and I noticed the effbot's response to the Unicode degree inquiry. I tried to create and print one and got this:
% python Python 2.1.1a1 (#9, Jun 4 2001, 11:32:33) [GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2 Type "copyright", "credits" or "license" for more information. >>> u"\N{DEGREE SIGN}" u'\xb0' >>> print u"\N{DEGREE SIGN}"
Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128)
Shouldn't I be able to print arbitrary Unicode objects? What am I missing (this time)?
The encoding:
print u"\N{DEGREE SIGN}".encode("latin1") °
Cheers,
Skippy's little helper.
--
In case you're not a computer person, I should probably point out
that "Real Soon Now" is a technical term meaning "sometime before
the heat-death of the universe, maybe".
-- Scott Fahlman
Me> [what am I missing?] Michael> The encoding: >>> print u"\N{DEGREE SIGN}".encode("latin1") ° Hmmm... I don't believe I've ever encountered an object in Python before that you couldn't simply print. Are Unicode objects unique in this respect? Seems like a bug (or at least a feature) to me. Skip
participants (2)
-
Michael Hudson
-
Skip Montanaro