wp-utf8-text

Validate and normalize UTF-8 text in WordPress plugins and imports.

21|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wp-utf8-text
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-utf8-text
Source: https://github.com/Lonsdale201/wp-agent-skills/tree/main/wordpress/wp-utf8-text
Command: npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wp-utf8-text

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about wp-utf8-text

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate UTF-8 text in WordPress plugins to prevent data corruption?

To validate UTF-8 text in WordPress plugins, use wp_is_valid_utf8() to detect invalid bytes before storage. This prevents data corruption and display issues when handling text from external sources like REST payloads or CSV imports.

What is the best way to scrub invalid UTF-8 sequences from CSV and XML imports in WordPress?

The best way to scrub invalid UTF-8 sequences from CSV and XML imports is applying wp_scrub_utf8(). This sanitizes data for safe display while preserving the original text whenever necessary to avoid downstream encoding errors.

When should I reject, scrub, or preserve invalid UTF-8 bytes in REST API payloads?

Decide whether to reject, scrub, or preserve invalid UTF-8 bytes in REST payloads by leveraging wp_check_invalid_utf8() and noncharacter checks. Apply boundary-aware rules across XML, JSON, and feeds to prevent data loss.

Does WordPress have built-in functions to check for invalid UTF-8 in emails and logs?

Yes, WordPress provides built-in functions to check for invalid UTF-8 in emails and logs. You can apply wp_is_valid_utf8() and wp_check_invalid_utf8() across imported text, API payloads, and log entries to ensure data integrity.

Why does my WordPress plugin display garbled text from legacy CSV feeds?

Your WordPress plugin displays garbled text from legacy CSV feeds because of invalid UTF-8 sequences. Applying wp_scrub_utf8() sanitizes the imported data for safe display, preventing encoding errors downstream.