fix(extension): UTF-8 encoding + noise filter enhancement (v0.5.39)

- http-bridge.ts: add req.setEncoding('utf8') to all POST handlers
  to fix Korean text corruption in pending/chat/dump payloads
- observer-script.ts: add inline pre-strip in cleanLines() for
  Material icon names concatenated by textContent without newlines
- observer-script.ts: apply cleanLines() to codeText extraction
- known-issues: document UTF-8 encoding and noise filter issues
This commit is contained in:
Variet Worker
2026-04-13 12:56:25 +09:00
parent 5a76e30993
commit 2a1ebf1020
7 changed files with 157 additions and 8 deletions

View File

@@ -128,6 +128,7 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
if (req.method === 'POST' && url.pathname === '/dump-html') {
let dumpBody = '';
req.setEncoding('utf8');
req.on('data', (c: string) => dumpBody += c);
req.on('end', () => {
try {
@@ -145,6 +146,7 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
if (req.method === 'POST' && url.pathname === '/test-rpc') {
let rpcBody = '';
req.setEncoding('utf8');
req.on('data', (c: string) => rpcBody += c);
req.on('end', async () => {
try {
@@ -248,6 +250,7 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
function _handlePending(req: any, res: any, ctx: HttpBridgeContext) {
let body = '';
req.setEncoding('utf8');
req.on('data', (c: string) => body += c);
req.on('end', () => {
try {
@@ -398,6 +401,7 @@ function _handleDeepInspectTrigger(res: any) {
function _handleDeepInspectResult(req: any, res: any, ctx: HttpBridgeContext) {
let body = '';
req.setEncoding('utf8');
req.on('data', (c: string) => body += c);
req.on('end', () => {
try {
@@ -420,6 +424,7 @@ function _handleDeepInspectResult(req: any, res: any, ctx: HttpBridgeContext) {
function _handleChatSnapshot(req: any, res: any, ctx: HttpBridgeContext) {
let body = '';
req.setEncoding('utf8');
req.on('data', (c: string) => body += c);
req.on('end', () => {
try {