Skip to content

Instantly share code, notes, and snippets.

@gabrieledarrigo
Created April 2, 2013 14:32
Show Gist options
  • Save gabrieledarrigo/5292665 to your computer and use it in GitHub Desktop.
Save gabrieledarrigo/5292665 to your computer and use it in GitHub Desktop.
Convert accented charcter
<?php
$str = "una qualsiasi stringa in UTF-8";
$str = trim($str); // elimina spazi all'inizio e alla fine della stringa
$str = strip_tags($str); // elimina i tag HTML
$str = utf8_decode($str); // da UTF-8 a ISO-8859-1
$str = html_entity_decode($str, ENT_QUOTES, "UTF-8"); // decodifica tutti i caratteri in HTML a caratteri semplici, e riporta la stringa in UTF-8
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment