---
title: "lint/php-8.2/no-utf8-encode-decode"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/php-8.2/no-utf8-encode-decode" />

In the [`modernize`](/docs/rules/sets/modernize) set. Safe fix. Gated by php-8.2.

## What it does

Change deprecated `utf8_decode()` and `utf8_encode()` to `mb_convert_encoding()`

## Configuration

```toml title="pun.toml"
[lint.rules]
"php-8.2/no-utf8-encode-decode" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`Utf8DecodeEncodeToMbConvertEncoding`](https://getrector.com/rule-detail/utf8-decode-encode-to-mb-convert-encoding-rector) (rector)

[More lint/php-8.2 rules](/docs/rules/lint/php-8.2) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
