import { readFileSync, existsSync } from 'node:fs'; import { execSync } from 'node:child_process'; const root = 'd:/work/ylrz_saas'; const files = execSync('git show --name-only --pretty=format: 5dfe60ed', { cwd: root }) .toString('utf8') .split(/\r?\n/) .filter(Boolean); const issues = []; for (const rel of files) { const path = `${root}/${rel.replace(/\\/g, '/')}`; if (!existsSync(path)) continue; if (!/\.(java|js|vue|sql|xml|md)$/.test(rel)) continue; const raw = readFileSync(path); const text = raw.toString('utf8'); const bom = raw.length >= 3 && raw[0] === 0xef && raw[1] === 0xbb && raw[2] === 0xbf; const fffd = text.includes('\uFFFD'); const qmarks = /[^\s]\?{2,}[^\s?]|\?{4,}/.test(text); const latinGarble = /[\u00c0-\u00ff]{3,}/.test(text); if (bom || fffd || qmarks || latinGarble) { issues.push({ rel, bom, fffd, qmarks, latinGarble }); } } console.log(JSON.stringify(issues, null, 2)); console.log('count', issues.length);