/** * {@inheritDoc} * * A list of supported encodings can be determined by running * {@link http://php.net/manual/en/function.mb-list-encodings.php `mb_list_encodings()`} */ public function convert($string, $to_encoding, $from_encoding = null) { $from_encoding = null !== $from_encoding ? $from_encoding : $this->resolveInputEncoding($string); $result = mb_convert_encoding($string, $to_encoding, $from_encoding); if (false === $result) { throw EncodingConversionFailureException::forStringAndEncodings($string, $from_encoding, $to_encoding); } return $result; }
/** * {@inheritDoc} */ public function convert($string, $to_encoding, $from_encoding = null) { $from_encoding = null !== $from_encoding ? $from_encoding : static::getInternalEncoding(); $result = iconv($from_encoding, $to_encoding, $string); if (false === $result) { throw EncodingConversionFailureException::forStringAndEncodings($string, $from_encoding, $to_encoding); } return $result; }