You are here

public function Cleantalk::stringFromUTF8 in Anti Spam by CleanTalk 7.4

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

Function convert string from UTF8 param string param string

Return value

string

1 call to Cleantalk::stringFromUTF8()
Cleantalk::httpRequest in src/Cleantalk.php
httpRequest

File

src/Cleantalk.php, line 681

Class

Cleantalk
Cleantalk Base class

Code

public 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;
}