How to convert a Chinese registry value from within a US code page?
Posted on 2007-07-23
First of all, our Win32 MFC VC++ app is not written in Unicode as it should have been. Given that - it reads uninstall information from the windows Uninstall registry tree and writes it to a report. It writes out the displayname of the application.
Normally this is not a problem, but when it encounters a Chinese application name, it displays the name as question marks. I assume this is because the string is in Unicode in the registry, but our app is not Unicode so it can't represent the characters.
Unfortunately for the moment, converting this very large app to Unicode is not an option.
How can we (or can we at all?) convert these "????" strings to their actual Chinese characters?
We have the Chinese character support added via the control panel's Regional Settings, so we can see the Chinese chars correctly when we view them in RegEdit, etc., even though our current regional settings are for US. (changing the regional settings via the control panel to Chinese is not an option). It's just our app that returns the ????? chars.
We've tried explicitly calling RegQueryValueExW to read the value, but it still comes back to us as '????'.
Is it possible to read a unicode string from the registry from a non-unicode application?
Any help would be greatly appreciated!