returns encode a sring in url
@param string $value
@return string
507984
public function urlPathEncode($value)
    {
        // cas de la valeur null
        if (is_null($value)) {
            return "";
        }
        // plus d'accents
        $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕç';
        $b = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRrc';
        $value = utf8_decode($value);
        $value = strtr($value, utf8_decode($a), $b);
        $value = strtolower($value);
        // ponctuation
        $value = strtr($value, utf8_decode("'\""), "__");
        // autres caracteres
        $value = preg_replace("/[^a-z0-9\-\_]/", "-", $value);
        return $value;
    }
850700
public static function encodeForMaria($value)
    {
        return is_string($value)
        && (!mb_check_encoding($value, 'UTF-8') || strpos($value, self::DATA_URI_PREFIX) === 0)
            ? self::DATA_URI_PREFIX . base64_encode($value)
            : $value;
    }
285289
private function encode($value)
    {
        if ($value === true)
            $value = "true";
        else if ($value === false)
            $value = "false";
        else if (is_string($value))
            $value = "\"$value\"";
        return $value;
    }
8369
protected function encode($value)
    {
        try {
            return $this->encoders->getEncoderForValue($value)
                ->encode($value, new EncodingContext());
        } catch (EncodingException | InvalidArgumentException | OutOfBoundsException $ex) {
            throw new SerializationException('Failed to serialize value', 0, $ex);
        }
    }
1287499
private function getEscape($value = '$value')
    {
        if ($this->customEscape) {
            return sprintf(self::CUSTOM_ESCAPE, $value);
        }

        return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
    }
158949
protected function encodeNotArray($value)
    {
        $value = (string) $value;
        $value = trim($value);
        $value = str_replace("\n", "\n\t", $value);

        return "\n\t{$value}\n";
    }
1260366
private static function encodeValueXml($value)
    {
        if ($value instanceof \DateTime) {
            return $value->format('Y-m-d\TH:i:s.000\Z');
        }
        else if (is_bool($value)){
            return $value ? 'true' : 'false';
        } else {
            return $value;
        }
    }
503237
protected function encode($value)
    {
        if (is_object($value) && method_exists($value, 'getJs')) {
            return new JsExpression($value->getJs());
        } elseif (is_bool($value)) {
            return new JsExpression(($value ? 'true' : 'false'));
        } elseif (is_array($value)) {
            $parsed = [];
            foreach ($value as $child) {
                $parsed[] = $this->encode($child);
            }
            return $parsed;
        }
        try {
            // a value may contain a valid JSON string
            return Json::decode($value);
        } catch (InvalidParamException $e) {
        }
        return $value;
    }
499450
final protected function decode(string $value): string
    {
        $parts = \imap_mime_header_decode($value);
        if (!\is_array($parts)) {
            return $value;
        }

        $decoded = '';
        foreach ($parts as $part) {
            $text = $part->text;
            if ('default' !== $part->charset) {
                $text = Transcoder::decode($text, $part->charset);
            }
            // RFC2231
            if (1 === \preg_match('/^(?<encoding>[^\']+)\'[^\']*?\'(?<urltext>.+)$/', $text, $matches)) {
                $hasInvalidChars = 1 === \preg_match('#[^%a-zA-Z0-9\-_\.\+]#', $matches['urltext']);
                $hasEscapedChars = 1 === \preg_match('#%[a-zA-Z0-9]{2}#', $matches['urltext']);
                if (!$hasInvalidChars && $hasEscapedChars) {
                    $text = Transcoder::decode(\urldecode($matches['urltext']), $matches['encoding']);
                }
            }

            $decoded .= $text;
        }

        return $decoded;
    }
963167
public function encode($value)
    {
        $json = json_encode($value);

        if ($code = json_last_error()) $this->throwError($code);

        return $json;
    }
228701
public static function encode($value)
    {
        $value = gmp_init($value, 10);
        $octets = chr(gmp_strval(gmp_and($value, 0x7f), 10));

        $rightShift = function ($number, $positions) {
            return gmp_div($number, gmp_pow(2, $positions));
        };

        $value = $rightShift($value, 7);
        while (gmp_cmp($value, 0) > 0) {
            $octets .= chr(gmp_strval(gmp_or(0x80, gmp_and($value, 0x7f)), 10));
            $value = $rightShift($value, 7);
        }

        return strrev($octets);
    }
1272434
public function asNtext($value)
    {
        if ($value === null) {
            return $this->getNullDisplay();
        }

        return nl2br(Html::encode($value));
    }
370668
protected function _validate_url($value)
    {
        if ($value === '') {
            return '';
        }

        if (strpos($value, '://') === false) {
            $value = 'http://' . $value;
        }

        return filter_var($value, FILTER_VALIDATE_URL) !== false ? $value : null;
    }
724480
public static function convertFromUrlencodeSqlComment($value)
    {
        if (preg_match_all('/(?:\%23.*?\%0a)/im',$value,$matches)){
            $converted = $value;
            foreach($matches[0] as $match){
                $converted = str_replace($match,' ',$converted);
            }
            $value .= "\n" . $converted;
        }
        return $value;
    }
916623
public function formatUrl($value)
	{
		$url=$value;
		if(strpos($url,'http://')!==0 && strpos($url,'https://')!==0)
			$url='http://'.$url;
		return CHtml::link(CHtml::encode($value),$url);
	}
452858
public function encode39($Value)
    {
        $this->Result = "100101101101" . "0";
        $TextString = "";
        for ($i = 1; $i <= strlen($Value); $i++) {
            $CharCode = ord($this->mid($Value, $i, 1));
            if ($CharCode >= 97 && $CharCode <= 122) {
                $CharCode = $CharCode - 32;
            }

            if (isset($this->Codes[chr($CharCode)])) {
                $this->Result = $this->Result . $this->Codes[chr($CharCode)] . "0";
                $TextString = $TextString . chr($CharCode);
            }
        }

        if ($this->MOD43) {
            $Checksum = $this->checksum($TextString);
            $this->Result = $this->Result . $this->Codes[$Checksum] . "0";
        }

        $this->Result = $this->Result . "100101101101";
        $TextString = "*" . $TextString . "*";

        return $TextString;
    }
485103
public function escapeHtml(string $value) : string
    {
        return htmlspecialchars($value, ENT_COMPAT, $this->encoding, false);
    }