What problem does it solve?
WordPress plugins frequently deal with text from CSV, XML, REST, emails, prompts, and external APIs. This skill provides guidance to validate, scrub, preserve, or reject invalid UTF-8 sequences to avoid data corruption and display issues.
Core Features & Use Cases
- Validation: Use wp_is_valid_utf8() to detect invalid bytes before storage or processing.
- Scrubbing & preservation: Apply wp_scrub_utf8() to sanitize data for safe display while preserving data when necessary.
- Boundary-aware decisions: Leverage wp_check_invalid_utf8() and noncharacter checks to decide whether to reject, scrub, or preserve input across XML/JSON/feeds, logs, and API payloads.
- Example: When importing a CSV from a legacy source, ensure all text fields pass validation or are scrubbed to prevent encoding errors downstream.
Quick Start
Process an imported text payload by validating, scrubbing, or preserving UTF-8 bytes according to the boundary rules.