You are here

function Cleantalk::stringFromUTF8 in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 src/lib/Cleantalk/Antispam/Cleantalk.php \Cleantalk\Antispam\Cleantalk::stringFromUTF8()

Function convert string from UTF8 param string param string

Return value

string

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

File

src/lib/Cleantalk/Antispam/Cleantalk.php, line 707

Class

Cleantalk
Cleantalk class create request

Namespace

Cleantalk\Antispam

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