locked
Chinese resource file problem RRS feed

  • Question

  • I am attempting to add Chinese (Taiwan) resources to an MFC application in Visual Studio 2005 (.NET Framework 2.0).  I have installed East Asian language support on my development box running Windows XP SP2.

    In the project configuration I have the Character Set set to "Use Unicode Character Set".

    To add the Chinese (Taiwan) resources I went to the Resources View of the Solution Explorer and created a Chinese (Taiwan) menu resource using Insert Copy... from the right-click popup menu.  I then went into the new resource and typed in the Chinese characters (using the language toolbar) I want for each string in the menu and everything looks fine.

    When I build my application and run it, the Chinese characters appear as "????".  I looked at the contents of the rc file and within the Chinese section of the file I see the question marks.

    Here is the Chinese section from the resource file:

    /////////////////////////////////////////////////////////////////////////////
    // Chinese (Taiwan) resources

    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT)
    #ifdef _WIN32
    LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
    #pragma code_page(950)
    #endif //_WIN32

    /////////////////////////////////////////////////////////////////////////////
    //
    // Menu
    //

    IDR_MAINFRAME MENU
    BEGIN
        POPUP "???"
        BEGIN
            MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
            MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
            MENUITEM "&Save\tCtrl+S",               ID_FILE_SAVE
            MENUITEM "Save &As...",                 ID_FILE_SAVE_AS
            MENUITEM SEPARATOR
            MENUITEM "&Print...\tCtrl+P",           ID_FILE_PRINT
            MENUITEM "Print Pre&view",              ID_FILE_PRINT_PREVIEW
            MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
            MENUITEM SEPARATOR
            MENUITEM "Recent File",                 ID_FILE_MRU_FILE1, GRAYED
            MENUITEM SEPARATOR
            MENUITEM "E&xit",                       ID_APP_EXIT
        END
        POPUP "????"
        BEGIN
            MENUITEM "&Undo\tCtrl+Z",               ID_EDIT_UNDO
            MENUITEM SEPARATOR
            MENUITEM "Cu&t\tCtrl+X",                ID_EDIT_CUT
            MENUITEM "&Copy\tCtrl+C",               ID_EDIT_COPY
            MENUITEM "&Paste\tCtrl+V",              ID_EDIT_PASTE
        END
        POPUP "??????"
        BEGIN
            MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR
            MENUITEM "&Status Bar",                 ID_VIEW_STATUS_BAR
        END
        POPUP "Language"
        BEGIN
            MENUITEM "Toggle Language",             ID_LANGUAGE_TOGGLELANGUAGE
        END
        POPUP "???"
        BEGIN
            MENUITEM "????...",                     ID_APP_ABOUT
        END
    END

    Could anyone please tell me what I am doing wrong here?  I performed the same actions in a test windows application in C# and everything worked fine.

     

    Friday, March 2, 2007 1:54 PM

Answers

All replies

  • Did you install Service Pack 1 (SP1)? it sounds like a problem that was fixed.

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105359

    Also even though you have set "use unicode character set", your RC file itself may still be MBCS.  You may have to open it up in notepad and then save as Unicode.

     

    Friday, March 2, 2007 2:28 PM
  • Thank you for the reply Ted.  I will look into your suggestions.  I thought that setting the Character Set to Unicode in the Project properties would cause the resource files to be saved as Unicode automatically.  Perhaps that is a bug that is fixed with SP1.  Unfortunately I have to get my IT department to download SP1 for me and perform the install since our PCs are completely locked down.  I'll post what I find out!  Thanks again.
    Friday, March 2, 2007 2:50 PM
  • No, the changing over of the RC to Unicode is not done automatically, even with SP1.  When a project is first generated, it uses non-Unicode RC format (for legacy reasons I guess). 

    Note: if SP1 is not something that you can adopt at this time, then changing the RC to Unicode yourself will avoid the bug I mentioned.  The Unicode file does not have the problem.  However, make sure you delete any APS files.  See http://www.mihai-nita.net/20051030a.shtml  for more details on a suggested approach to change over to Unicode.

     

    Friday, March 2, 2007 3:41 PM
  • I managed to get SP1 installed and the problem is now resolved.  Thank you for your help Ted!
    Friday, March 2, 2007 5:20 PM