Skip to content

Instantly share code, notes, and snippets.

View nicolap's full-sized avatar

Nicola nicolap

  • SO.LO Soluzioni Logiche ICT
  • Pisa - Italy
View GitHub Profile
@nicolap
nicolap / gist:1028735
Created June 16, 2011 05:42
Conversione dei caratteri accentati o strambi in ASCII
$text = '\1234567890\'ì|!"£$%&/()=?^¬¹²³¼½¬{[]}`~è+òàù,.-<_:;>ç°§*é^?`~[]@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ€ÖÄÜöäüß';
function to7bit($text,$from_enc) {
$text = mb_convert_encoding($text,'HTML-ENTITIES',$from_enc);
$text = preg_replace(
array('/&szlig;/','/&(..)lig;/',
'/&([aouAOU])uml;/','/&(.)[^;]*;/'),
array('ss',"$1","$1".'e',"$1"),
$text);
return $text;