You are here

function Cleantalk::stringFromUTF8 in Anti Spam by CleanTalk 8

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 645

Class

Cleantalk
Cleantalk class create request

Namespace

Drupal\cleantalk

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