Code solutions to PHP, JS, CSSCode source PHP, JS, CSS

Spread your code soluces to the world

Love me
Solucior » PHP » Convert unknown text to ISO8859-1

Convert unknown text to ISO8859-1

05/19/2011 by Dux   -   not rated

This method is useful if you get a text field to display in ISO8859-1. In some cases, you do not know if the writer has written characters in UTF8 or ISO. Especially if the text has gone through several transitional stages.

source code



 
<?php
$html
= 'car. string';

$utf8 = html_entity_decode(html_entity_decode(htmlentities( $html , ENT_NOQUOTES, 'UTF-8' )));
if (
trim($utf8) != "" ) echo utf8_decode($html); else echo $html;

?>
Rate this code     |     Copied : 28x

Comments for Convert unknown text to ISO8859-1

No comment
Add a comment Nickname   Site
ZOOM