The MASM Forum

General => The Campus => Topic started by: wanker742126 on October 28, 2024, 04:16:19 PM

Title: Can RC.EXE Automatically Detect ASCII or UTF-16 Encoding?
Post by: wanker742126 on October 28, 2024, 04:16:19 PM
Hello everyone,

I hope you're all doing well. I have a question regarding the RC.EXE resource compiler in Windows development. I was wondering if RC.EXE can automatically detect whether a .rc file is encoded in ASCII or UTF-16, or if any special configuration is required for this. I want to ensure my .rc files are processed correctly and avoid any encoding-related issues.

Thank you very much for your insights and guidance!
Title: Re: Can RC.EXE Automatically Detect ASCII or UTF-16 Encoding?
Post by: TimoVJL on October 28, 2024, 05:18:40 PM
Perhaps have to use BOM.

What Raymond said:
The Resource Compiler defaults to CP_ACP, even in the face of subtle hints that the file is UTF-8 (https://devblogs.microsoft.com/oldnewthing/20190607-00/?p=102569)
Title: Re: Can RC.EXE Automatically Detect ASCII or UTF-16 Encoding?
Post by: wanker742126 on October 28, 2024, 05:35:20 PM
Quote from: TimoVJL on October 28, 2024, 05:18:40 PMPerhaps have to use BOM.

What Raymond said:
The Resource Compiler defaults to CP_ACP, even in the face of subtle hints that the file is UTF-8 (https://devblogs.microsoft.com/oldnewthing/20190607-00/?p=102569)
Thank you very much for your answer! In that case, I'll make sure to select the UTF-8 (with BOM) format when saving .RC files in UltraEdit from now on.
Title: Re: Can RC.EXE Automatically Detect ASCII or UTF-16 Encoding?
Post by: fearless on October 28, 2024, 09:51:34 PM
You can also use unicode in resource files if you set to UTF-16 LE BOM in Notepad++ or i presume UltraEdit as well. Notepad also handles editing of UTF-16 LE BOM files, and in some cases works better than Notepad++ - I found this out when adding CN and FA languages to my media player - Notepad++ would sometimes should incorrect characters, but plain Notepad (Win10) was able to view and edit the text properly for the .rc files, when pasting unicode text.
Title: Re: Can RC.EXE Automatically Detect ASCII or UTF-16 Encoding?
Post by: wanker742126 on October 29, 2024, 12:29:39 AM
Thank fearless,
I just tested Notepad on Win10. When saving a file, it only offers ANSI, UTF-16LE, UTF-16BE, UTF-8, and UTF-8 BOM options. Later, I found that UTF-16LE and UTF-16BE automatically add BOM by default.