iTerm2, unicode and sympy In my both Mac (OS X Mavericks) and Ubuntu machine, I have installed sympy that is a python library for symbolic mathematics. Part of sympy is the pretty print functionality that uses unicode characters to prettify symbolic expressions in the command-line environments with unicode support. For example, in my Ubuntu machine and in its gnome-terminal running the following code
from sympy import *
x = Symbol(&quot;x&quot;)
pprint(Integral(sqrt(1/x), x)) 

renders to

However, the same command in OS X with iTerm2 (that should support unicode) results in

I'm using sympy 0.7.5 that I have made from source with the latest build of iTerm2 (Build 1.0.0.20140518). Is there anything that I miss here? The lead developer of sympy is one of the StackExchange network. It would be great to know his opinion on this one.
I finally found out what the problem is. The problem was not with the terminal emulators themselves as both OSX Terminal and iTerm2 were using UTF-8 by default. It turned out one has to inform python explicitly that the terminal is capable of handling unicode by way of 

export PYTHONIOENCODING=utf-8


Credits to this stackoverflow answer.