Internationalization Cookbook
This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Unicode .RC in VS 2005

Q. The Resource Editor in Visual Studio 2005 supports Unicode, my application is Unicode, but at runtime it shows question marks!

A. The .RC file should be saved as Unicode, and by default is not.

Ok, so the long awaited Visual Studio 2005 is final and ready for all to use.

And one of the features that many users seem to expect is there (although sometimes they don’t even know they did). I am talking about Unicode support in the resource editor (the one producing .RC files for native C/C++ applications, not the one for .NET applications, that is the Forms Editor :-))

Why do I say that many expected the feature without knowing? Because of complains that “I copy Japanese characters from Word to my dialog, but I get question marks.”

Not anymore! You can do this in Visual Studio 2005 and all is ok. Or is it not?

Let’s make a small experiment

  • Create a MFC application from scratch, and select Dialog based in Application type (you may also notice that there is a new option, Use Unicode libraries, and it is checked by default. Kudos! The time if ANSI is gone!)
  • In the Advanced features step, under the Context-sensitive Help there is an old radio button: WinHelp Format (unsupported), but is grayed out! Why is there? Why not just remove it? Ok, we should not be mean. This has nothing to do with our internationalization problems, so move along, nothing to see here.
  • Run the application; all works fine, no problems.

Now we try to put some Japanese in there. Copy and paste from some Japanese web site (for example Microsoft Japan) or type it using the Japanese IME (typing “nihongo” will give you 日本語, meaning “Japanese language”).

Bingo! Looks ok! Save, build solution and run.

What?!? Question marks! Why?

  • We frantically check the project settings: Use Unicode Character Set. Ok here.
  • We try MessageBox( _T("\x65E5\x672C\x8A9E") ); and we get our “Japanese language”. So the application really is Unicode.
  • We mark the resources and dialog as Japanese, still question marks.
  • We open the .RC file in Notepad and we see question marks. Why? Is Notepad wrong? We try other editors, even some hex ones. Yes, the question marks are real!

Now it is clear why the application shows question marks. Because they are there! The resource editor is Unicode, allows you to input any character, then saves the file as ANSI, without any warning!

If we try this with Notepad, we get an error message: This file contains characters in Unicode format which will be lost if you save this file as an ANSI encoded text file. To keep the Unicode information, click Cancel below and then select one of the Unicode options from the Encoding drop down list. Continue? Notepad is smarter!

So we know where the question marks are coming from. But if we close Visual Studio, start it again, the Japanese is there. Where are the Japanese characters coming from?

The answer: from the .APS file. This is a binary, proprietary and undocumented file format, containing a parsed version of the .RC file. Not very useful.

Ok, this is a small sample application. But let’s assume you have a really big thing, and someone have spent many hours doing copy/paste to localize 200 dialogs (this is not how it should be done, but let’s just assume is the case).

If you try to convert the .RC to Unicode yourself, Visual Studio detects that the .RC is newer, override the .APS (with the question marks) and all work is gone!

So, first of all, make a copy of the .RC and .APS file somewhere, just in case.

Now we try to fix the problem.

From the Solution Explorer we select the .RC file, then File -> Save As… hoping we will get an option to save as Unicode. Auch! Visual Studio crashes! (I have tried this on Windows XP SP2 and Windows Vista build 5231, it crashes on both).


  • Close your active VS solution: File -> Close Solution
  • Open the .RC file: File -> Open -> File, select the .RC and click Open
  • Save it as Unicode: File -> Save As… and DO NOT click Save!!! Click the small down-arrow at the right of the Save button and select Save with Encoding…. Say Yes, check the Save resource file as Unicode, and click Ok.
  • Close the file: File -> Close Solution (why a solution when I have only opened a file?)
  • Open your original solution. Build and run.

Everything should be all right now!

Leave a comment