Printing the terminal:
> python -c 'print u"\xae"' # no complaints here!
®
Printing to a file:
> python -c 'print u"\xae"' > tmp.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 0: ordinal not in range(128)
The error also occurs when piping to cat, for example.
Because it can’t guess the encoding properly and assumes that it’s “ascii”. Encode to UTF-8 when the output is not a TTY.