Use OEM codepage for console I/O

Windows console applications use different codepages for console I/O
and the rest of the API:

   http://msdn.microsoft.com/en-us/goglobal/bb688114.aspx#E2F

Attempt to workaround this by converting characters when they're read from
and written to the console.  Not all possible paths are handled.