Improved print function that handles ANSI escapes even on Windows