Skip to content

Instantly share code, notes, and snippets.

@dlueth
Created June 27, 2013 21:33
Show Gist options
  • Save dlueth/5880612 to your computer and use it in GitHub Desktop.
Save dlueth/5880612 to your computer and use it in GitHub Desktop.
PHP modifier to convert the encoding of any given string (requires mb_string)
function convertCharset($value, $characterset = NULL) {
return (mb_check_encoding($value, $characterset) === true) ? $value : mb_convert_encoding($value, $characterset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment