incomplete fix for unicode support

Untested, haven't been applied to editor and several tools. Don't merge until confirmation from windows users.