use MS Windows API for Unicode and/or stdout support

This is former #699 (unfortunately I do not know way to re-open old one).
Hopefully this finally closes #440 #441 #479.