The new version of Resource Hacker FX partially supports Unicode.
- Decompilation and compilation of: string table, message table, accelerators, menu, version info.
- Menu and dialog preview.
What’s not supported:
Everything else, including:
- Dialog’s control editor.
- Export to .rc file.
- Unicode file names.
Technical details: how did I do that?
So, how did I make Resource Hacker handle Unicode without having it’s source code?
Originally, Resource Hacker’s decompilation process looks more-or-less like this:
Decompiled text (ANSI)
A native Unicode resource editor would look like this:
Decompiled text (Unicode)
But making Resource Hacker work this way would require rewriting it’s decompilation functions, as they expect ANSI text, and we want to decompile Unicode.
So, to achieve our goal of easily making Resource Hacker handle Unicode, we need the following:
- The Unicode information must be preserved in memory.
- The decompilation functions should work without a major change.
I was thinking about whether this is even possible, and then it hit me: UTF-8!
UTF-8 is (Wikipedia):
a variable-width encoding that can represent every character in the Unicode character set. It was designed for backward compatibility with ASCII and to avoid the complications of endianness and byte order marks in UTF-16 and UTF-32.
Exactly what we need, eh?
Now we can make the decompilation process look like this:
Decompiled text (UTF-8)
Making it is relatively easy, and because UTF-8 is backward compatible with ASCII, the original decompiling functions work almost without changes.
The latest question left is: how do we show the decompiled text in Resource Hacker, while it uses non-Unicode controls?
Luckily for us, Resource Hacker uses the rich edit control, which supports multiple encodings even as a non-Unicode control. (this support is not 100%, e.g. you cannot paste Unicode text copied from an external program)
Get the new Resource Hacker FXer here.