mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-10-10 04:03:04 +08:00
fix(ui): restore utf-8 encoding and remove mojibake in select output
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user