Skip to content

Instantly share code, notes, and snippets.

@betawax
Created February 11, 2011 09:42
Show Gist options
  • Save betawax/822138 to your computer and use it in GitHub Desktop.
Save betawax/822138 to your computer and use it in GitHub Desktop.
Encode a ISO-8859-1 string to UTF-8 if necessary
$foobar = (mb_detect_encoding($foobar, 'UTF-8, ISO-8859-1') != 'UTF-8' ? utf8_encode($foobar) : $foobar);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment