/** * Rewrite lobster admin vue files with correct UTF-8 Chinese. * Run: node java/scripts/fix-lobster-vue-encoding.js */ const fs = require('fs') const path = require('path') const root = path.resolve(__dirname, '../..') const uddDebug = ` ` function write(rel, content) { const target = path.join(root, rel) fs.writeFileSync(target, content, { encoding: 'utf8' }) const check = fs.readFileSync(target, 'utf8') const ok = /[\u4e00-\u9fff]/.test(check) && !check.includes('\ufffd') console.log(rel, ok ? 'OK' : 'FAIL', check.split('\n')[5].slice(0, 70)) } write('saas-mgnui/src/views/lobster/udd-debug/index.vue', uddDebug) // industry-corpus-matrix: read current structure from git blob via exec - use separate minimal fix script part 2 const industryPath = path.join(root, 'saas-mgnui/src/views/lobster/industry-corpus-matrix/index.vue') let industry = fs.readFileSync(industryPath, 'utf8') const replacements = [ ['label="\u95ee\u95ee"', 'label="\u573a\u666f"'], // fallback if still broken ['label="锟斤拷锟斤拷"', 'label="锟斤拷锟斤拷"'], ['placeholder="全锟斤拷锟斤拷锟斤拷"', 'placeholder="全锟斤拷锟斤拷锟斤拷"'], ['>锟斤拷锟斤拷<', '>\u641c\u7d22<'], ['>锟斤拷锟斤拷<', '>\u91cd\u7f6e<'], ['>锟斤拷始锟斤拷锟斤拷前锟斤拷业<', '>\u521d\u59cb\u5316\u5f53\u524d\u884c\u4e1a<'], ['>AI+锟斤拷锟斤拷锟斤拷锟斤拷<', '>AI+\u8054\u7f51\u8865\u9f50<'], ['>锟斤拷锟斤拷锟斤拷锟斤拷锟较碉拷锟斤拷<', '>\u4ece\u9500\u51a0\u8bed\u6599\u5bfc\u5165<'], ['>锟斤拷锟斤拷锟斤拷目<', '>\u65b0\u589e\u6761\u76ee<'], ] // If file is fully corrupted, rebuild from unicode-escaped template in part 2 file if (!industry.includes('\u573a\u666f') && !industry.includes('锟斤拷锟斤拷')) { console.log('industry-corpus-matrix needs full rewrite - run part 2') process.exitCode = 1 } else { fs.writeFileSync(industryPath, industry, 'utf8') console.log('industry-corpus-matrix', 'kept existing if readable') }