fix(ui): restore utf-8 encoding and remove mojibake in select output

This commit is contained in:
Arvin
2026-04-25 20:11:07 +08:00
parent 3b5d059ca6
commit 659ac556be
7 changed files with 119 additions and 57 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
if grep -R -n '馃\|鑺\|绛\|閫\|璇\|摝\|殌' scripts/; then
echo "Detected mojibake text in scripts/" >&2
exit 1
fi
python3 - <<'PY'
from pathlib import Path
import sys
bad = []
for path in Path("scripts").rglob("*.sh"):
data = path.read_bytes()
if data.startswith(b"\xef\xbb\xbf"):
bad.append(f"{path}: UTF-8 BOM is not allowed")
continue
try:
data.decode("utf-8")
except UnicodeDecodeError as exc:
bad.append(f"{path}: invalid UTF-8 ({exc})")
if bad:
print("\n".join(bad), file=sys.stderr)
sys.exit(1)
PY
+19
View File
@@ -0,0 +1,19 @@
name: Text Encoding
on:
pull_request:
push:
branches:
- main
- master
jobs:
utf8:
runs-on: ubuntu-latest
env:
LANG: C.UTF-8
LC_ALL: C.UTF-8
steps:
- uses: actions/checkout@v4
- name: Check mojibake and UTF-8 encoding
run: bash .github/scripts/check-text-encoding.sh