W3cubDocs

/Drupal 8

class Unicode

Provides Unicode-related conversions and operations.

Hierarchy

  • class \Drupal\Component\Utility\Unicode

Related topics

Utility classes and functions
Overview of utility classes and functions for developers.

File

core/lib/Drupal/Component/Utility/Unicode.php, line 10

Namespace

Drupal\Component\Utility

Members

Name Modifiers Type Description
Unicode::$status protected static property Holds the multibyte capabilities of the current environment.
Unicode::caseFlip public static function Flip U+C0-U+DE to U+E0-U+FD and back. Can be used as preg_replace callback.
Unicode::check public static function Checks for Unicode support in PHP and sets the proper settings if possible.
Unicode::convertToUtf8 public static function Converts data to UTF-8.
Unicode::encodingFromBOM public static function Decodes UTF byte-order mark (BOM) into the encoding's name.
Unicode::getStatus public static function Gets the current status of unicode/multibyte support on this environment.
Unicode::lcfirst public static function Converts the first character of a UTF-8 string to lowercase.
Unicode::mimeHeaderDecode public static function Decodes MIME/HTTP encoded header values.
Unicode::mimeHeaderEncode public static function Encodes MIME/HTTP headers that contain incorrectly encoded characters.
Unicode::PREG_CLASS_WORD_BOUNDARY constant Matches Unicode characters that are word boundaries.
Unicode::setStatus public static function Sets the value for multibyte support status for the current environment.
Unicode::STATUS_ERROR constant Indicates an error during check for PHP unicode support.
Unicode::STATUS_MULTIBYTE constant Indicates that full unicode support with the PHP mbstring extension is being used.
Unicode::STATUS_SINGLEBYTE constant Indicates that standard PHP (emulated) unicode support is being used.
Unicode::strcasecmp public static function Compares UTF-8-encoded strings in a binary safe case-insensitive manner.
Unicode::strlen public static function Counts the number of characters in a UTF-8 string.
Unicode::strpos public static function Finds the position of the first occurrence of a string in another string.
Unicode::strtolower public static function Converts a UTF-8 string to lowercase.
Unicode::strtoupper public static function Converts a UTF-8 string to uppercase.
Unicode::substr public static function Cuts off a piece of a string based on character indices and counts.
Unicode::truncate public static function Truncates a UTF-8-encoded string safely to a number of characters.
Unicode::truncateBytes public static function Truncates a UTF-8-encoded string safely to a number of bytes.
Unicode::ucfirst public static function Capitalizes the first character of a UTF-8 string.
Unicode::ucwords public static function Capitalizes the first character of each word in a UTF-8 string.
Unicode::validateUtf8 public static function Checks whether a string is valid UTF-8.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Unicode.php/class/Unicode/8.1.x