add debug function
use wchar for file opening
add wrapper for win32 unicode handling