@param string $encoding

@return string
976306
public function compile($encoding = 'UTF-8'): string
    {
        $output = '';
        foreach ( $this->compilables as $compilable ) {
            $output .= $compilable->compile($encoding);
        }

        return $output;
    }
406021
public function inputEncoding(string $encoding): self
    {
        $encoding = $this->filterEncoding($encoding);
        if ($encoding === $this->input_encoding) {
            return $this;
        }

        $clone = clone $this;
        $clone->input_encoding = $encoding;

        return $clone;
    }
1526
public static function setDefaultEncoding($encoding=null)
    {
        if(!is_null($encoding) && is_string($encoding) && !empty($encoding))
        {
            self::$defaultencoding = $encoding;
        }
        else
        {
            self::$defaultencoding = null;
        }
    }
61331
private static String convertJava2MimeEncoding(String encoding)
    {
        EncodingInfo enc =
            (EncodingInfo) _encodingTableKeyJava.get(toUpperCaseFast(encoding));
        if (null != enc)
            return enc.name;
        return encoding;
    }
1159505
private static function decode_value($value, $encoding)
    {
        switch (strtolower($encoding)) {
        case 'quoted-printable':
            self::$values_decoded = true;
            return quoted_printable_decode($value);

        case 'base64':
        case 'b':
            self::$values_decoded = true;
            return base64_decode($value);

        default:
            return $value;
        }
    }
457075
protected function decodePunycode($encoded)
    {
        $prefix = 'xn--';
        $safe_char = 0xFFFC;
        $base = 36;
        $tmin = 1;
        $tmax = 26;
        $skew = 38;
        $damp = 700;

        if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) {
            return $encoded;
        }

        $is_first = true;
        $bias = 72;
        $idx = 0;
        $char = 0x80;
        $decoded = array();
        $output = '';

        $delim_pos = strrpos($encoded, '-');
        if ($delim_pos > strlen($prefix)) {
            for ($k = strlen($prefix); $k < $delim_pos; ++$k) {
                $decoded[] = ord($encoded{$k});
            }
        }
        $deco_len = count($decoded);
        $enco_len = strlen($encoded);

        for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
            for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) {
                $cp = ord($encoded{$enco_idx++});
                $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
                $idx += $digit * $w;
                $t = ($k <= $bias) ? $tmin : (($k >= $bias + $tmax) ? $tmax : ($k - $bias));
                if ($digit < $t) {
                    break;
                }
                $w = (int)($w * ($base - $t));
            }
            $delta = $idx - $old_idx;
            $delta = intval($is_first ? ($delta / $damp) : ($delta / 2));
            $delta += intval($delta / ($deco_len + 1));
            for ($k = 0; $delta > (($base - $tmin) * $tmax) / 2; $k += $base) {
                $delta = intval($delta / ($base - $tmin));
            }
            $bias = intval($k + ($base - $tmin + 1) * $delta / ($delta + $skew));
            $is_first = false;
            $char += (int)($idx / ($deco_len + 1));
            $idx %= ($deco_len + 1);
            if ($deco_len > 0) {
                for ($i = $deco_len; $i > $idx; $i--) {
                    $decoded[$i] = $decoded[($i - 1)];
                }
            }
            $decoded[$idx++] = $char;
        }

        foreach ($decoded as $k => $v) {
            if ($v < 128) {
                $output .= chr($v);
            } // 7bit are transferred literally
            elseif ($v < (1 << 11)) {
                $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
            } // 2 bytes
            elseif ($v < (1 << 16)) {
                $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
            } // 3 bytes
            elseif ($v < (1 << 21)) {
                $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
            } // 4 bytes
            else {
                $output .= $safe_char;
            } //  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
        }
        return $output;
    }
130263
public static function lower( $string, $encoding = null )
	{
		if ( is_null( $encoding ) )
		{
			$encoding = ClanCats::$config->charset;
		}
		return mb_strtolower( $string, $encoding );
	}
349576
public function upper($encoding = null)
    {
        if (!$this->hasMbstring()) {
            return $this->transform('\strtoupper');
        }

        $encoding = $this->encoding($encoding);

        return $this->transform('\mb_convert_case', MB_CASE_UPPER, $encoding);
    }
301079
public static function upperFirst(string $str, string $encoding = null) : string
    {
        $encoding = $encoding ?: utils\Str::encoding($str);

        // Uppercase the first character and append the remainder.
        return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_substr($str, 1, null, $encoding);
    }
1042257
public function isAcceptEncoding($encoding)
    {
        if ($this->hasHeader('Accept-Encoding')) {
            return $this->isAccept($this->getHeader('Accept-Encoding'), $encoding);
        }
        return false;
    }
262160
protected function decode($encoded) {
		$val = substr($encoded, 1);
		switch ($encoded[0]) {
			case self::T_ARRAY:
				return json_decode($val, true);
			case self::T_INT:
				return intval($val);
			case self::T_BOOLEAN:
				return !!$val;
			case self::T_DOUBLE:
				return floatval($val);
			case self::T_OBJECT:
				return unserialize($val);
			default:
				return $val;
		}
	}
301355
function CharConvert(&$array, $encoding) {

		// identical encoding - end here
		if ($encoding == $this->encoding) {
			return;
		}

		// loop thru array
		foreach ($array as $key => $value) {

			// go recursive
			if (is_array($value)) {
				$this->CharConvert($array[$key], $encoding);
			}

			// convert string
			elseif (is_string($value)) {
				$array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value));
			}
		}
	}
66438
public function SetEncoding($Encoding) {
      if ($Encoding != '' && $Encoding !== FALSE) {
         // Make sure to pass through any named parameters from queries defined before the connection was opened.
         $SavedNamedParameters = $this->_NamedParameters;
         $this->_NamedParameters = array();
         $this->_NamedParameters[':encoding'] = $Encoding;
         $this->Query('set names :encoding');
         $this->_NamedParameters = $SavedNamedParameters;
      }
   }
1338023
private static function unicodeToEntitiesPreservingAscii($unicode)
    {
        $entities = '';

        foreach ($unicode as $value) {
            if ($value != 65279) {
                $entities .= $value > 127
                             ? '\uc0{\u' . $value . '}'
                             : chr($value);
            }
        }

        return $entities;
    }
1292572
public function ensurePrefix($substring, $encoding = null)
    {
        if (!$this->hasMbstring()) {
            $len = \strlen($substring);
            if (\substr($this->string, 0, $len) == $substring) {
                return $this;
            }
        } else {
            $encoding = $this->encoding($encoding);
            $len = \mb_strlen($substring, $encoding);
            if (\mb_substr($this->string, 0, $len, $encoding) == $substring) {
                return $this;
            }
        }

        return $this->prefix($substring);
    }
328719
public static function convertToHtmlEntities($string, $encoding)
    {
        if (function_exists('mb_convert_encoding')) {
            return mb_convert_encoding($string, 'HTML-ENTITIES', $encoding);
        }

        if ('UTF-8' !== $encoding) {
            $string = iconv($encoding, 'UTF-8//IGNORE', $string);
        }

        return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'htmlEncodingCallback'], $string);
    }
725641
public static function dashed(string $str, string $encoding = null) : string
    {
        return static::delimit($str, '-', $encoding);
    }