PHPackages                             api-skeletons/correct-utf8-encoding - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. api-skeletons/correct-utf8-encoding

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

api-skeletons/correct-utf8-encoding
===================================

Correct badly encoded and multiple encoded UTF8 characters by examining each byte in a string.

1.0.0(7y ago)0211MITPHP

Since Jan 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/API-Skeletons/correct-utf8-encoding)[ Packagist](https://packagist.org/packages/api-skeletons/correct-utf8-encoding)[ RSS](/packages/api-skeletons-correct-utf8-encoding/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Correct utf-8 Encoding
======================

[](#correct-utf-8-encoding)

[![Build Status](https://camo.githubusercontent.com/fa8f0a03054d48b2dcc86b081232516cb6ced28dddbf0ce405ca07a1ef4e7811/68747470733a2f2f7472617669732d63692e6f72672f4150492d536b656c65746f6e732f636f72726563742d757466382d656e636f64696e672e737667)](https://travis-ci.org/API-Skeletons/correct-utf8-encoding)[![Gitter](https://camo.githubusercontent.com/c45f0485e89d3cd41f666d7d4bb5875cb59836555e05b6b11f77ed223eb64c0c/68747470733a2f2f6261646765732e6769747465722e696d2f6170692d736b656c65746f6e732f6f70656e2d736f757263652e737667)](https://gitter.im/api-skeletons/open-source)[![Patreon](https://camo.githubusercontent.com/f9e075baad95563481d35174d43ef50757281abb6bc795d0f473fad452afa030/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617472656f6e2d646f6e6174652d79656c6c6f772e737667)](https://www.patreon.com/apiskeletons)[![Total Downloads](https://camo.githubusercontent.com/33fb1b86419561a93b8302dc9a85feaf5e61e90818a2d580946334ac558e1ffd/68747470733a2f2f706f7365722e707567782e6f72672f6170692d736b656c65746f6e732f636f72726563742d757466382d656e636f64696e672f646f776e6c6f616473)](https://packagist.org/packages/api-skeletons/correct-utf8-encoding)

When utf-8 data is mishandled it can become multiple encoded. Data with invalid utf-8 sequences cannot be properly imported to databases and renders incorrectly in a correctly encoded web page.

The class provided by this module examines a string byte-by-byte. It does not use predefined sequences to match against data. Instead it walks through the string looking for possible utf8 data and looping on the data until it produces a valid utf-8 character.

Use
---

[](#use)

```
use ApiSkeletons\Utf8;

$correctUtf8Encoding = new Utf8\CorrectUtf8Encoding();

$validString = $correctUtf8Encoding($invalidString);
```

Comment
-------

[](#comment)

This library is unlike the other UTF8 correction tools available on packagist at the time of this writing. Whether this tool is better than other offerings is based soley on your success with the tool. For my needs this tool corrected a 20 year old dataset for the entire database field-by-field and byte-by-byte.

Please don't hesitate to contact  with any stories of success or failure with this tool.

Correct Entire Database
-----------------------

[](#correct-entire-database)

There is a companion application which uses this library to correct every invalid utf8 character in an entire database. Please see

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2675d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49dd7d9dba889ac674b0da447d9c1e69d1128dc3ccbaef98ba83d6ee519fc2d6?d=identicon)[tom\_anderson](/maintainers/tom_anderson)

---

Top Contributors

[![TomHAnderson](https://avatars.githubusercontent.com/u/493920?v=4)](https://github.com/TomHAnderson "TomHAnderson (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/api-skeletons-correct-utf8-encoding/health.svg)

```
[![Health](https://phpackages.com/badges/api-skeletons-correct-utf8-encoding/health.svg)](https://phpackages.com/packages/api-skeletons-correct-utf8-encoding)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
