Add helper functions for safe unicode transformations.
Check all uses of MultiByteToWideChar and WideCharToMultiByte

Fixes issue 452.