/** * @license * Copyright 2025 Vybestack LLC * SPDX-License-Identifier: Apache-2.0 */ /** * Sanitizes Unicode strings by handling replacement characters and ensuring * proper UTF-8 encoding for API transmission. */ /** * Removes or replaces Unicode replacement characters (U+FFFD) from a string. * These characters often appear when there are encoding/decoding errors. * * @param text The text to sanitize * @param replacement What to replace U+FFFD with (default: '?') * @returns The sanitized text */ export declare function sanitizeUnicodeReplacements(text: string, replacement?: string): string; /** * Checks if a string contains Unicode replacement characters (U+FFFD). * * @param text The text to check * @returns True if the text contains replacement characters */ export declare function hasUnicodeReplacements(text: string): boolean; /** * Checks if a string contains characters that are unsafe for JSON serialization. * This includes: * - Unicode replacement characters (U+FFFD) * - Unpaired surrogates (high surrogate without low, or low without high) * - Control characters (except tab, newline, carriage return) * * @param text The text to check * @returns True if the text contains JSON-unsafe characters */ export declare function hasJsonUnsafeCharacters(text: string): boolean; /** * Ensures a string is safe for JSON serialization and API transmission. * This handles various edge cases including: * - Unicode replacement characters * - Control characters * - Invalid surrogate pairs * * @param text The text to make safe * @returns The sanitized text */ export declare function ensureJsonSafe(text: string): string; /** * Attempts to detect and fix common cp932 (Shift-JIS) decoding issues. * This is specifically for Windows Japanese locale users. * * @param text The text that may have cp932 encoding issues * @returns The cleaned text */ export declare function cleanCp932Artifacts(text: string): string;