Lines Matching refs:encoding
155 public static function mb_decode_numericentity($s, $convmap, $encoding = null) argument
167 if (null !== $encoding && !\is_scalar($encoding)) {
178 $encoding = self::getEncoding($encoding);
180 if ('UTF-8' === $encoding) {
181 $encoding = null;
186 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
208 if (null === $encoding) {
212 return iconv('UTF-8', $encoding.'//IGNORE', $s);
215 public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) argument
227 if (null !== $encoding && !\is_scalar($encoding)) {
244 $encoding = self::getEncoding($encoding);
246 if ('UTF-8' === $encoding) {
247 $encoding = null;
252 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
278 if (null === $encoding) {
282 return iconv('UTF-8', $encoding.'//IGNORE', $result);
285 public static function mb_convert_case($s, $mode, $encoding = null) argument
292 $encoding = self::getEncoding($encoding);
294 if ('UTF-8' === $encoding) {
295 $encoding = null;
300 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
360 if (null === $encoding) {
364 return iconv('UTF-8', $encoding.'//IGNORE', $s);
367 public static function mb_internal_encoding($encoding = null) argument
369 if (null === $encoding) {
373 $normalizedEncoding = self::getEncoding($encoding);
385 …ew \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
414 public static function mb_encoding_aliases($encoding) argument
416 switch (strtoupper($encoding)) {
425 public static function mb_check_encoding($var = null, $encoding = null) argument
427 if (null === $encoding) {
431 $encoding = self::$internalEncoding;
435 …return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var);
439 if (!self::mb_check_encoding($key, $encoding)) {
442 if (!self::mb_check_encoding($value, $encoding)) {
515 public static function mb_strlen($s, $encoding = null) argument
517 $encoding = self::getEncoding($encoding);
518 if ('CP850' === $encoding || 'ASCII' === $encoding) {
522 return @iconv_strlen($s, $encoding);
525 public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) argument
527 $encoding = self::getEncoding($encoding);
528 if ('CP850' === $encoding || 'ASCII' === $encoding) {
543 return iconv_strpos($haystack, $needle, $offset, $encoding);
546 public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) argument
548 $encoding = self::getEncoding($encoding);
549 if ('CP850' === $encoding || 'ASCII' === $encoding) {
558 $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
562 $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
567 ? iconv_strrpos($haystack, $needle, $encoding)
568 : self::mb_strlen($haystack, $encoding);
573 public static function mb_str_split($string, $split_length = 1, $encoding = null) argument
591 if (null === $encoding) {
592 $encoding = mb_internal_encoding();
595 if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
607 $length = mb_strlen($string, $encoding);
610 $result[] = mb_substr($string, $i, $split_length, $encoding);
616 public static function mb_strtolower($s, $encoding = null) argument
618 return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
621 public static function mb_strtoupper($s, $encoding = null) argument
623 return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
644 public static function mb_substr($s, $start, $length = null, $encoding = null) argument
646 $encoding = self::getEncoding($encoding);
647 if ('CP850' === $encoding || 'ASCII' === $encoding) {
652 $start = iconv_strlen($s, $encoding) + $start;
661 $length = iconv_strlen($s, $encoding) + $length - $start;
667 return (string) iconv_substr($s, $start, $length, $encoding);
670 public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) argument
673 self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding),
674 self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding),
677 return self::mb_strpos($haystack, $needle, $offset, $encoding);
680 public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) argument
682 $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
684 return self::getSubpart($pos, $part, $haystack, $encoding);
687 public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) argument
689 $encoding = self::getEncoding($encoding);
690 if ('CP850' === $encoding || 'ASCII' === $encoding) {
693 $needle = self::mb_substr($needle, 0, 1, $encoding);
694 $pos = iconv_strrpos($haystack, $needle, $encoding);
697 return self::getSubpart($pos, $part, $haystack, $encoding);
700 public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) argument
702 $needle = self::mb_substr($needle, 0, 1, $encoding);
703 $pos = self::mb_strripos($haystack, $needle, $encoding);
705 return self::getSubpart($pos, $part, $haystack, $encoding);
708 public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) argument
710 $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding);
711 $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding);
716 return self::mb_strrpos($haystack, $needle, $offset, $encoding);
719 public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) argument
766 public static function mb_http_output($encoding = null) argument
768 return null !== $encoding ? 'pass' === $encoding : 'pass';
771 public static function mb_strwidth($s, $encoding = null) argument
773 $encoding = self::getEncoding($encoding);
775 if ('UTF-8' !== $encoding) {
776 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
784 public static function mb_substr_count($haystack, $needle, $encoding = null) argument
794 public static function mb_chr($code, $encoding = null) argument
806 if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
807 $s = mb_convert_encoding($s, $encoding, 'UTF-8');
813 public static function mb_ord($s, $encoding = null) argument
815 if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
816 $s = mb_convert_encoding($s, 'UTF-8', $encoding);
837 …length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string argument
843 if (null === $encoding) {
844 $encoding = self::mb_internal_encoding();
846 …self::assertEncoding($encoding, 'mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "…
849 if (self::mb_strlen($pad_string, $encoding) <= 0) {
853 $paddingRequired = $length - self::mb_strlen($string, $encoding);
861 …self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string;
863 …$string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding);
868 …leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength)…
872 public static function mb_ucfirst(string $string, ?string $encoding = null): string argument
874 if (null === $encoding) {
875 $encoding = self::mb_internal_encoding();
877 …self::assertEncoding($encoding, 'mb_ucfirst(): Argument #2 ($encoding) must be a valid encoding, "…
880 $firstChar = mb_substr($string, 0, 1, $encoding);
881 $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding);
883 return $firstChar.mb_substr($string, 1, null, $encoding);
886 public static function mb_lcfirst(string $string, ?string $encoding = null): string argument
888 if (null === $encoding) {
889 $encoding = self::mb_internal_encoding();
891 …self::assertEncoding($encoding, 'mb_lcfirst(): Argument #2 ($encoding) must be a valid encoding, "…
894 $firstChar = mb_substr($string, 0, 1, $encoding);
895 $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding);
897 return $firstChar.mb_substr($string, 1, null, $encoding);
900 private static function getSubpart($pos, $part, $haystack, $encoding) argument
906 return self::mb_substr($haystack, 0, $pos, $encoding);
909 return self::mb_substr($haystack, $pos, null, $encoding);
951 private static function getEncoding($encoding) argument
953 if (null === $encoding) {
957 if ('UTF-8' === $encoding) {
961 $encoding = strtoupper($encoding);
963 if ('8BIT' === $encoding || 'BINARY' === $encoding) {
967 if ('UTF8' === $encoding) {
971 return $encoding;
974 …public static function mb_trim(string $string, ?string $characters = null, ?string $encoding = nul… argument
976 …return self::mb_internal_trim('{^[%s]+|[%1$s]+$}Du', $string, $characters, $encoding, __FUNCTION__…
979 …public static function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = nu… argument
981 return self::mb_internal_trim('{^[%s]+}Du', $string, $characters, $encoding, __FUNCTION__);
984 …public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = nu… argument
986 return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__);
989 …ernal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function… argument
991 if (null === $encoding) {
992 $encoding = self::mb_internal_encoding();
994 …self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "…
998 return null === $encoding ? $string : self::mb_convert_encoding($string, $encoding);
1001 if ('UTF-8' === $encoding) {
1002 $encoding = null;
1010 $string = iconv($encoding, 'UTF-8//IGNORE', $string);
1013 $characters = iconv($encoding, 'UTF-8//IGNORE', $characters);
1025 if (null === $encoding) {
1029 return iconv('UTF-8', $encoding.'//IGNORE', $string);
1032 private static function assertEncoding(string $encoding, string $errorFormat): void argument
1035 $validEncoding = @self::mb_check_encoding('', $encoding);
1037 throw new \ValueError(sprintf($errorFormat, $encoding));
1042 throw new \ValueError(sprintf($errorFormat, $encoding));