57 lines
3.3 KiB
Markdown
57 lines
3.3 KiB
Markdown
# Mojibake Repair (Temporary)
|
|
|
|
Version 1.1.0 replaces the original whole-column SQL conversion with targeted
|
|
replacements for Czech letters misdecoded as ISO-8859-1 or Windows-1252.
|
|
|
|
## Why version 1.0.0 could break fonts
|
|
|
|
The original conversion also changed `options` and metadata. Theme and builder
|
|
settings can contain PHP-serialized strings with embedded **byte lengths**.
|
|
Changing the text without updating those lengths makes the settings unreadable;
|
|
a theme can then fall back to default typography. Converting entire values could
|
|
also damage already-correct Unicode in mixed content. WordPress documents this
|
|
serialization risk in its [migration guide](https://developer.wordpress.org/advanced-administration/upgrade/migrating/).
|
|
|
|
## Sites already repaired with version 1.0.0
|
|
|
|
1. Deactivate version 1.0.0 and save a copy of the current database.
|
|
2. Use a pre-repair backup to compare and recover affected theme/builder settings,
|
|
preferably on staging first. A full database restore can discard newer content
|
|
and orders, so choose the recovery scope using the site's actual changes.
|
|
3. Run the new version's preview against the restored data and review the changes.
|
|
The new version prevents this serialization damage; it does not reconstruct
|
|
settings already corrupted by the previous conversion.
|
|
4. After repair, clear page caches and regenerate builder CSS if the site uses it.
|
|
Verify fonts and content on the site, then deactivate and remove the plugin.
|
|
|
|
## Behavior and limits
|
|
|
|
- Repairs recognized Czech mojibake sequences without transcoding whole values.
|
|
Other corruption patterns and JSON `\uXXXX` escapes are outside this repair's
|
|
scope. A sequence intentionally shown as a mojibake example will also match,
|
|
so review the preview.
|
|
- Preserves CSS, JSON escaping, serialized keys and scalar formatting. Repairs
|
|
serialized array/string values, including nested serialized strings, and
|
|
recalculates their byte lengths without instantiating PHP objects.
|
|
- Leaves an entire candidate value unchanged if it contains malformed or
|
|
unsupported serialization, objects, references, excessive nesting, or invalid
|
|
UTF-8. The preview reports skipped counts and example row IDs. This is not a
|
|
general audit of already-corrupted settings: values without a recognized
|
|
mojibake sequence are left untouched without further inspection.
|
|
- Reads in batches of 200. Execution uses an InnoDB transaction and checks the
|
|
exact candidate IDs and values against the signed preview. Changes since
|
|
preview or write conflicts cause rollback. Old-version approvals are rejected.
|
|
- Clears the WordPress object cache after commit. External page caches and
|
|
generated builder styles may still need to be refreshed separately.
|
|
- Scans the current site's fixed core-table plan. Large databases may exceed
|
|
hosting request limits; batching bounds the rows loaded at once, not the total
|
|
request duration or transaction size.
|
|
|
|
## Local verification
|
|
|
|
Run `php -l wp-mojibake-repair.php` and `php tests/repair.php`.
|
|
The regression script requires PDO SQLite and iconv. It checks Czech text,
|
|
serialized typography settings, preserved CSS/JSON, skipped unsafe values,
|
|
batching, preview approvals, rollback, and cache invalidation. Database-flow
|
|
checks use a SQLite adapter; they do not replace verification on WordPress/MySQL.
|