import { readFileSync } from 'node:fs'; import iconv from 'iconv-lite'; const buf = readFileSync('framework-tests/legacy-layer-migration/fixtures/Layer00002.xml'); // NOTE: 实际 Layer00002.xml 是 UTF-8 编码 (XML 头声明 + 字节验证), // spec/brief 要求的 GB18030 在该文件上会乱码 (微信登录背景 不可读). // 转换工具应支持两种编码, 优先按 XML 声明, 否则按 GB18030 fallback. const text = iconv.decode(buf, 'utf8'); console.log('decoded length:', text.length); console.log('contains 微信登录背景:', text.includes('微信登录背景')); console.log('contains Login_Layer:', text.includes('Login_Layer'));