Lines Matching defs:encoding
19 * - mb_convert_encoding - Convert character encoding
26 * - mb_detect_encoding - Detect character encoding
28 * - mb_http_input - Detect HTTP input character encoding
29 * - mb_http_output - Set/Get HTTP output character encoding
30 * - mb_internal_encoding - Set/Get internal character encoding
33 * - mb_output_handler - Callback function converts character encoding in output buffer
57 * - mb_regex_encoding - Returns current encoding for multibyte regex as string
141 public static function mb_decode_numericentity($s, $convmap, $encoding = null)
153 if (null !== $encoding && !is_scalar($encoding)) {
164 $encoding = self::getEncoding($encoding);
166 if ('UTF-8' === $encoding) {
167 $encoding = null;
172 $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
194 if (null === $encoding) {
198 return \iconv('UTF-8', $encoding.'//IGNORE', $s);
201 public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
213 if (null !== $encoding && !is_scalar($encoding)) {
230 $encoding = self::getEncoding($encoding);
232 if ('UTF-8' === $encoding) {
233 $encoding = null;
238 $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
264 if (null === $encoding) {
268 return \iconv('UTF-8', $encoding.'//IGNORE', $result);
271 public static function mb_convert_case($s, $mode, $encoding = null)
278 $encoding = self::getEncoding($encoding);
280 if ('UTF-8' === $encoding) {
281 $encoding = null;
286 $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
342 if (null === $encoding) {
346 return \iconv('UTF-8', $encoding.'//IGNORE', $s);
349 public static function mb_internal_encoding($encoding = null)
351 if (null === $encoding) {
355 $normalizedEncoding = self::getEncoding($encoding);
367 throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
396 public static function mb_encoding_aliases($encoding)
398 switch (strtoupper($encoding)) {
407 public static function mb_check_encoding($var = null, $encoding = null)
409 if (null === $encoding) {
413 $encoding = self::$internalEncoding;
416 return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var);
484 public static function mb_strlen($s, $encoding = null)
486 $encoding = self::getEncoding($encoding);
487 if ('CP850' === $encoding || 'ASCII' === $encoding) {
491 return @\iconv_strlen($s, $encoding);
494 public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
496 $encoding = self::getEncoding($encoding);
497 if ('CP850' === $encoding || 'ASCII' === $encoding) {
512 return \iconv_strpos($haystack, $needle, $offset, $encoding);
515 public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
517 $encoding = self::getEncoding($encoding);
518 if ('CP850' === $encoding || 'ASCII' === $encoding) {
527 $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
531 $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
536 ? \iconv_strrpos($haystack, $needle, $encoding)
537 : self::mb_strlen($haystack, $encoding);
542 public static function mb_str_split($string, $split_length = 1, $encoding = null)
559 if (null === $encoding) {
560 $encoding = mb_internal_encoding();
563 if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
575 $length = mb_strlen($string, $encoding);
578 $result[] = mb_substr($string, $i, $split_length, $encoding);
584 public static function mb_strtolower($s, $encoding = null)
586 return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
589 public static function mb_strtoupper($s, $encoding = null)
591 return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
612 public static function mb_substr($s, $start, $length = null, $encoding = null)
614 $encoding = self::getEncoding($encoding);
615 if ('CP850' === $encoding || 'ASCII' === $encoding) {
620 $start = \iconv_strlen($s, $encoding) + $start;
629 $length = \iconv_strlen($s, $encoding) + $length - $start;
635 return (string) \iconv_substr($s, $start, $length, $encoding);
638 public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
640 $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
641 $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
643 return self::mb_strpos($haystack, $needle, $offset, $encoding);
646 public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
648 $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
650 return self::getSubpart($pos, $part, $haystack, $encoding);
653 public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
655 $encoding = self::getEncoding($encoding);
656 if ('CP850' === $encoding || 'ASCII' === $encoding) {
659 $needle = self::mb_substr($needle, 0, 1, $encoding);
660 $pos = \iconv_strrpos($haystack, $needle, $encoding);
663 return self::getSubpart($pos, $part, $haystack, $encoding);
666 public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
668 $needle = self::mb_substr($needle, 0, 1, $encoding);
669 $pos = self::mb_strripos($haystack, $needle, $encoding);
671 return self::getSubpart($pos, $part, $haystack, $encoding);
674 public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
676 $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
677 $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
679 return self::mb_strrpos($haystack, $needle, $offset, $encoding);
682 public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
729 public static function mb_http_output($encoding = null)
731 return null !== $encoding ? 'pass' === $encoding : 'pass';
734 public static function mb_strwidth($s, $encoding = null)
736 $encoding = self::getEncoding($encoding);
738 if ('UTF-8' !== $encoding) {
739 $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
747 public static function mb_substr_count($haystack, $needle, $encoding = null)
757 public static function mb_chr($code, $encoding = null)
769 if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
770 $s = mb_convert_encoding($s, $encoding, 'UTF-8');
776 public static function mb_ord($s, $encoding = null)
778 if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
779 $s = mb_convert_encoding($s, 'UTF-8', $encoding);
800 private static function getSubpart($pos, $part, $haystack, $encoding)
806 return self::mb_substr($haystack, 0, $pos, $encoding);
809 return self::mb_substr($haystack, $pos, null, $encoding);
851 private static function getEncoding($encoding)
853 if (null === $encoding) {
857 if ('UTF-8' === $encoding) {
861 $encoding = strtoupper($encoding);
863 if ('8BIT' === $encoding || 'BINARY' === $encoding) {
867 if ('UTF8' === $encoding) {
871 return $encoding;