You are here

protected function Escaper::fromUtf8 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-escaper/src/Escaper.php \Zend\Escaper\Escaper::fromUtf8()

Converts a string from UTF-8 to the base encoding. The base encoding is set via this class' constructor.

Parameters

string $string:

Return value

string

3 calls to Escaper::fromUtf8()
Escaper::escapeCss in vendor/zendframework/zend-escaper/src/Escaper.php
Escape a string for the CSS context. CSS escaping can be applied to any string being inserted into CSS and escapes everything except alphanumerics.
Escaper::escapeHtmlAttr in vendor/zendframework/zend-escaper/src/Escaper.php
Escape a string for the HTML Attribute context. We use an extended set of characters to escape that are not covered by htmlspecialchars() to cover cases where an attribute might be unquoted or quoted illegally (e.g. backticks are valid quotes for IE).
Escaper::escapeJs in vendor/zendframework/zend-escaper/src/Escaper.php
Escape a string for the Javascript context. This does not use json_encode(). An extended set of characters are escaped beyond ECMAScript's rules for Javascript literal string escaping in order to prevent misinterpretation of Javascript as HTML…

File

vendor/zendframework/zend-escaper/src/Escaper.php, line 337

Class

Escaper
Context specific methods for use in secure output escaping

Namespace

Zend\Escaper

Code

protected function fromUtf8($string) {
  if ($this
    ->getEncoding() === 'utf-8') {
    return $string;
  }
  return $this
    ->convertEncoding($string, $this
    ->getEncoding(), 'UTF-8');
}