Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I transform "é" to é in php?

Tags:

php

encoding

I have an XML ISO-8859-1 page, in which I have to output symbols like é.
If I output é it errors out. é works just fine.
So, what PHP function should I use to transform é to é

I can't move to utf-8 (as I assume some will suggest and rightfully so) This is a huge, legacy code.

like image 678
Itay Moav -Malimovka Avatar asked Dec 04 '25 17:12

Itay Moav -Malimovka


1 Answers

Use mb_convert_encoding:

mb_convert_encoding("é", "HTML-ENTITIES", "ISO-8859-1");

gives ‚.

This example does not require that you enter the "é", which you may or may not be doing in ISO-8859-1:

mb_convert_encoding(chr(130), "HTML-ENTITIES", "ISO-8859-1");
like image 96
Artefacto Avatar answered Dec 06 '25 07:12

Artefacto