src/Uri.php
/**
     * Encode invalid UTF-8 characters in given string. All other characters are unchanged.
     */
Encode invalid UTF-8 characters in given string. All other characters are unchanged.
Encode invalid UTF - 8 characters in given string . All other characters are unchanged .
private function filterInvalidUtf8(string $string) : string
    {
        if (preg_match('//u', $string)) {
            return $string;
        }
        $letters = str_split($string);
        foreach ($letters as $i => $letter) {
            if (! preg_match('//u', $letter)) {
                $letters[$i] = $this->urlEncodeChar([$letter]);
            }
        }
        return implode('', $letters);
    }
private function filterInvalidUtf8 ( string $ string ) : string { if ( preg_match ( '//u' , $ string ) ) { return $ string ; } $ letters = str_split ( $ string ) ; foreach ( $ letters as $ i => $ letter ) { if ( ! preg_match ( '//u' , $ letter ) ) { $ letters [ $ i ] = $ this -> urlEncodeChar ( [ $ letter ] ) ; } } return implode ( '' , $ letters ) ; }
Encode invalid UTF-8 characters in given string.
Encode invalid UTF - 8 characters in given string .
// check if given string contains only valid UTF-8 characters