PHPackages                             tomwilford/php-utf8-to-rtf - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tomwilford/php-utf8-to-rtf

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tomwilford/php-utf8-to-rtf
==========================

A simple package to convert UTF8 characters to RTF

v1.1.1(1mo ago)09.9k—6.7%BSD-3-ClausePHPPHP ^7.4 || ^8.0CI passing

Since Jan 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/TomWilford/php-utf8-to-rtf)[ Packagist](https://packagist.org/packages/tomwilford/php-utf8-to-rtf)[ RSS](/packages/tomwilford-php-utf8-to-rtf/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

PHP UTF8 To RTF
===============

[](#php-utf8-to-rtf)

[![QA & Tests](https://github.com/TomWilford/php-utf8-to-rtf/actions/workflows/tests.yml/badge.svg)](https://github.com/TomWilford/php-utf8-to-rtf/actions/workflows/tests.yml)[![Coverage Status](https://camo.githubusercontent.com/c96078770d08848329698dc282f24a4d69bb74f31fdffff65fb83d08879eb000/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f546f6d57696c666f72642f7068702d757466382d746f2d7274662f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/TomWilford/php-utf8-to-rtf?branch=main)[![PHP Version](https://camo.githubusercontent.com/30a58377171d7f4d8bdabfce2fe93b03cd2e9bf710f564e75376315c613d45d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e34253230253743253743253230253545382e302d3838393262662e737667)](https://packagist.org/packages/TomWilford/php-utf8-to-rtf)[![License](https://camo.githubusercontent.com/d695f6f7abc2c9dd0ee2fc40242a916e323a2a0b2ea157eae92130f9033329f6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f546f6d57696c666f72642f7068702d757466382d746f2d727466)](LICENSE)

Description
-----------

[](#description)

A simple PHP class for converting UTF8 characters to an RTF safe version in a string.

Installation
------------

[](#installation)

`composer require tomwilford/php-utf8-to-rtf`

Usage
-----

[](#usage)

> Requires PHP 7.4 or higher

Instantiate the converter using:

```
$converter = new CharacterConverter();
```

To find and replace UTF8 characters with RTF safe versions in a long string use:

```
$convertedString = $converter->findAndReplace($string);
```

Or, for shorter strings and characters, simply convert the whole string:

```
$convertedString = $converter->convertStringToRtf($string);
```

You can also convert an array of UTF8 strings:

```
$convertedArray = $converter->convertArrayToRtf($arrayOfStrings);
```

Finally, if you need to do any additional processing on the UTF8 characters before converting, you can extract them as an array using:

```
$arrayToConvert = $converter->locateCharactersInString($string);
```

Testing
-------

[](#testing)

PHPUnit tests have been written using series of pangrams sourced online to try to best capture as many characters as possible in different languages being used in a natural way. Please see the [Pangrams trait](tests/Trait/Pangrams.php) for the pangram sources' credits.

There also is a short script that can [generate a test RTF file](tests/scripts/generate-test-rtf.php) that can be opened in a word processor to verify the results.

Contributing
------------

[](#contributing)

Contributions are welcome, please see [CONTRIBUTING](CONTRIBUTING.md) for more information.

Software License
----------------

[](#software-license)

Copyright (c) 2022. Tom Wilford All rights reserved.

This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance91

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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

Every ~640 days

Total

3

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a82b2ac25a173ec4556a091b046ee9a269060f5a8d0a2b13eb3d4e490fee5fa5?d=identicon)[jollyBlueMan](/maintainers/jollyBlueMan)

---

Top Contributors

[![TomWilford](https://avatars.githubusercontent.com/u/28453594?v=4)](https://github.com/TomWilford "TomWilford (37 commits)")

---

Tags

convertutf8converterrtf

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomwilford-php-utf8-to-rtf/health.svg)

```
[![Health](https://phpackages.com/badges/tomwilford-php-utf8-to-rtf/health.svg)](https://phpackages.com/packages/tomwilford-php-utf8-to-rtf)
```

###  Alternatives

[goetas-webservices/xsd2php

Convert XSD (XML Schema) definitions into PHP classes and JMS metadata

2401.7M49](/packages/goetas-webservices-xsd2php)[pixel418/markdownify

The HTML to Markdown converter for PHP

196897.8k8](/packages/pixel418-markdownify)[goetas-webservices/xsd2php-runtime

Convert XSD (XML Schema) definitions into PHP classes

4913.3M48](/packages/goetas-webservices-xsd2php-runtime)[kartik-v/yii2-markdown

Advanced Markdown editing and conversion utilities for Yii Framework 2.0

89276.5k6](/packages/kartik-v-yii2-markdown)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46164.0k6](/packages/jstewmc-rtf)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6665.2k](/packages/sbsaga-toon)

PHPackages © 2026

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