You are here

function Cleantalk::stringFromUTF8 in Anti Spam by CleanTalk 7.2

Same name and namespace in other branches
  1. 7.5 src/Cleantalk.php \Cleantalk::stringFromUTF8()
  2. 7 cleantalk.module \Cleantalk::stringFromUTF8()
  3. 7.4 src/Cleantalk.php \Cleantalk::stringFromUTF8()

Function convert string from UTF8 param string param string

Return value

string

1 call to Cleantalk::stringFromUTF8()
Cleantalk::httpRequest in ./cleantalk.module
httpRequest

File

./cleantalk.module, line 1160
Main CleanTalk integration module functions.

Class

Cleantalk
Cleantalk class create request

Code

function stringFromUTF8($str, $data_codepage = null) {
  if (preg_match('//u', $str) && function_exists('mb_convert_encoding') && $data_codepage !== null) {
    return mb_convert_encoding($str, $data_codepage, 'UTF-8');
  }
  return $str;
}