mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
fix: remove BOM/SIG from *.rc files
This commit is contained in:
parent
bc7f39a4c4
commit
a0de050a26
3
.github/copilot-instructions.md
vendored
3
.github/copilot-instructions.md
vendored
@ -188,6 +188,9 @@ No native ARM64 grepWin build exists. The ARM64 build uses `grepWin-x64_portable
|
||||
|
||||
- **Formatting**: LLVM-based `.clang-format` in `src\` — 4-space indentation, Stroustrup brace style, left-aligned pointers, no column limit, no include sorting
|
||||
- **Editor config**: `.editorconfig` enforces UTF-8/CRLF for source files, 4-space indentation for C/C++; Lexilla code uses tabs (preserved from upstream)
|
||||
- **File encoding rules** (must be respected when creating or editing these files):
|
||||
- `language\*\*.rc` — **UTF-8 without BOM**. Never write or save these files with a UTF-8 BOM. Use `Build\rc_to_utf8.cmd` to strip accidental BOMs.
|
||||
- `Build\Notepad3.ini`, `Build\minipath.ini` — **UTF-8 with BOM** (BOM = `EF BB BF`). These INI reference files must retain the BOM.
|
||||
- **String safety**: Uses `strsafe.h` throughout; deprecated string functions are disabled
|
||||
|
||||
### Type conventions
|
||||
|
||||
5
Build/rc_to_utf8.cmd
Normal file
5
Build/rc_to_utf8.cmd
Normal file
@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
REM Convert UTF-8-BOM encoded language RC files to pure UTF-8 (no BOM)
|
||||
REM Usage: rc_to_utf8.cmd
|
||||
|
||||
powershell -ExecutionPolicy Bypass -File "%~dp0scripts\rc_to_utf8.ps1"
|
||||
34
Build/scripts/rc_to_utf8.ps1
Normal file
34
Build/scripts/rc_to_utf8.ps1
Normal file
@ -0,0 +1,34 @@
|
||||
# Convert UTF-8-BOM encoded language RC files to pure UTF-8 (no BOM)
|
||||
# Usage: .\rc_to_utf8.ps1
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$RepoRoot = Split-Path -Parent (Split-Path -Parent $ScriptDir)
|
||||
$LangDir = Join-Path $RepoRoot "language"
|
||||
|
||||
Write-Host "Stripping UTF-8 BOM from RC files in: $LangDir" -ForegroundColor Yellow
|
||||
|
||||
$bom = [byte[]](0xEF, 0xBB, 0xBF)
|
||||
$converted = 0
|
||||
$skipped = 0
|
||||
|
||||
Get-ChildItem -Path $LangDir -Filter "*.rc" -Recurse | ForEach-Object {
|
||||
$bytes = [System.IO.File]::ReadAllBytes($_.FullName)
|
||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq $bom[0] -and $bytes[1] -eq $bom[1] -and $bytes[2] -eq $bom[2]) {
|
||||
$stripped = $bytes[3..($bytes.Length - 1)]
|
||||
[System.IO.File]::WriteAllBytes($_.FullName, $stripped)
|
||||
Write-Host " Converted: $($_.FullName.Substring($LangDir.Length + 1))" -ForegroundColor Cyan
|
||||
$converted++
|
||||
}
|
||||
else {
|
||||
$skipped++
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
if ($converted -gt 0) {
|
||||
Write-Host "Done! Converted $converted file(s), skipped $skipped file(s) (no BOM)." -ForegroundColor Green
|
||||
}
|
||||
else {
|
||||
Write-Host "Done! No files needed conversion ($skipped file(s) already BOM-free)." -ForegroundColor Green
|
||||
}
|
||||
@ -273,6 +273,9 @@ No native ARM64 grepWin build exists. The ARM64 build uses `grepWin-x64_portable
|
||||
|
||||
- LLVM-based `.clang-format` in `src\` — 4-space indentation, Stroustrup brace style, left-aligned pointers, no column limit, no include sorting
|
||||
- `.editorconfig` enforces UTF-8/CRLF for source, 4-space indent for C/C++; Lexilla code uses tabs (preserved from upstream)
|
||||
- **File encoding rules** (must be respected when creating or editing these files):
|
||||
- `language\*\*.rc` — **UTF-8 without BOM**. Never write or save these files with a UTF-8 BOM. Use `Build\rc_to_utf8.cmd` to strip accidental BOMs.
|
||||
- `Build\Notepad3.ini`, `Build\minipath.ini` — **UTF-8 with BOM** (BOM = `EF BB BF`). These INI reference files must retain the BOM.
|
||||
- String safety via `strsafe.h` throughout; deprecated string functions are disabled
|
||||
|
||||
### Type Conventions
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
// encoding: UTF-8
|
||||
#pragma code_page(65001) // UTF-8
|
||||
#include "resource.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user