/** * Mojibake detection for the MCP WordPress write path. * * Mojibake: UTF-8 bytes decoded as cp1252, then re-encoded as UTF-8. * The guard refuses writes that contain these sequences to protect the DB. * * Detection strategy (all patterns use Unicode escapes): * 1. U+00E2 U+20AC prefix — byte pair 0xE2 0x80 decoded via cp1252: * 0xE2 → U+00E2 (â), 0x80 → U+20AC (€ via cp1252). * Prefix of em-dash, en-dash, smart quotes, bullet, ellipsis, etc. * Almost never appears in legitimate text. * 2. U+00C3 + (U+00A0–U+00BF) — byte pair 0xC3 + 0xA0-0xBF decoded * via Latin-1. Signature of 2-byte UTF-8 Latin Extended chars. * 3. (U+00E0–U+00EF) + two chars from the cp1252 continuation set — * signature of 3-byte UTF-8 CJK and other non-Latin scripts. * The continuation set covers U+00A0-U+00BF (0xA0-0xBF, same in * cp1252 and Latin-1) plus the specific cp1252 mappings for 0x82-0x9F. */ /** * Return true if the string contains likely-mojibake byte sequences. */ export declare function isMojibake(s: string): boolean; /** * Throw if any string in the payload looks like mojibake. * * Call this before every POST/PUT/PATCH that writes WordPress content. * A false positive refuses a write (recoverable). A false negative would * corrupt the database (hard to recover). The guard is intentionally strict. */ export declare function assertNoMojibake(payload: unknown, context?: string): void; //# sourceMappingURL=mojibake.d.ts.map