Overload print function to filter out unprintable characters especially for the encoding bug of Windows console

This patch is an alternative implementation of #55.
While the old one requires to use a customed print function, this patch replaces the function.
It might solve #81.