You are here

function fixEncoding in Recipe 7.2

Same name and namespace in other branches
  1. 7 recipe.module \fixEncoding()

Checks a string for ISO-8859-1 chars and encodes them to UTF-8.

Parameters

string $in_str: A string with possible ISO-8859-1 chars.

Return value

string A UTF8 string representation of $in_str.

1 call to fixEncoding()
recipe_mastercook4_import_single in modules/recipe_mastercook4.module

File

./recipe.module, line 1343
Contains functions for Recipe node CRUD and display.

Code

function fixEncoding($in_str) {
  $cur_encoding = mb_detect_encoding($in_str);
  if ($cur_encoding == "UTF-8" && mb_check_encoding($in_str, "UTF-8")) {
    return $in_str;
  }
  else {
    return utf8_encode($in_str);
  }
}