Paul Chitescu wrote:
Changelog: regedit: Allow importing UCS-2 and UTF-8 files created by Windows' regedit v5.
The code tries to detect the encoding from the first read bytes. UTF-8 is not modified while UCS-2 is converted by keeping only the lower byte.
The code that you have added is really nasty. At the very least, you should be using WideCharToMultiByte to convert the UCS-2 characters, instead of just truncating them. Ideally though, the code should be converted to call the Unicode versions of the registry APIs and then to use MultiByteToWideChar to process UTF-8 and ASCII (CP_UNIXCP?) files.