VS2019: How to resolve the “unknown sub-lang: 0x8” message in Resource View?

前端 未结 6 849
有刺的猬
有刺的猬 2021-01-12 19:06

I have recently started using Visual Studio 2019 for my C++11 project. VS2019 converted the project and it compiles into an executable. But I can\'t open my resource (.rc) f

相关标签:
6条回答
  • 2021-01-12 19:40

    What helped me, was to replace this:

    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

    #pragma code_page(1252)

    (which specifies language English, US with ANSI Latin 1; Western European (Windows) encoding)

    By this :

    LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

    #pragma code_page(65001)

    (which specifies Language neutral with UTF-8 encoding)

    Once I'd made that change (making sure the .rc file was UTF-8 encoded), Visual Studio no longer complained.

    See https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers and https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-makelangid#remarks

    0 讨论(0)
  • 2021-01-12 19:46

    This solution helped for me: https://developercommunity.visualstudio.com/comments/96766/view.html

    When you have multiple language settings in your Windows, remove all but one. I had to leave the English (US) option. Then the resource opens again without problems. Hope this helps someone (or myself in the future as this is the second time I spend an hour to search for a solution).

    0 讨论(0)
  • 2021-01-12 19:46

    Changing the language actually did not matter in my case, I just converted it to UNICODE (in Microsoft Notepad - I assume this is UTF-16) - And it did the trick.

    Note that there is an answer here, regarding UTF-8, which did not work for me.

    0 讨论(0)
  • 2021-01-12 19:53

    I've found a solution that worked for me.

    1. Open the *.rc file in the 'Code View' in Visual Studio.
    2. Search for the following section:
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
    LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
    #pragma code_page(1252)
    ...
    
    1. Comment the complete #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD) block and save the file.

    2. Open the file in the 'Resource View'. Close it. (Maybe you have to change and save something here)

    3. Reopen the *.rc file via the 'Code View' in Visual Studio. Uncomment the previously commented section and save the file.

    After this steps the problem was solved. I don't know which of the steps solved the problem but in the end this was my way to solve the issue.

    My solution was inspired by the following solution: https://www.codeproject.com/Questions/40860/Resource-file-opening-problem

    0 讨论(0)
  • 2021-01-12 19:58

    The problem is not related to the language setting, but the RC file is stored incorrectly. My file was in ANSI format. As soon as I opened the file with Windows Notepad and saved it as Unicode, I was able to open and edit the resource project in the studio again. (0xFF 0xFE was missing)

    0 讨论(0)
  • 2021-01-12 20:01

    Posting my solution for those that encounter similar issues.

    I found that the malfunctioning rc files had ANSI encoding. Converting them to UTF-8 did the trick. You can easily do that using Notepad++ via the [Encoding] menu option, select [Convert to UTF-8].

    What I don't understand is why VS doesn't fix this itself when converting a project.

    0 讨论(0)
提交回复
热议问题