Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utf8.php
| Show First 20 Lines • Show All 706 Lines • ▼ Show 20 Lines | throw new Exception( | ||||
| "but the '%s' PHP extension is not available. Install %s to ". | "but the '%s' PHP extension is not available. Install %s to ". | ||||
| "work with encodings other than UTF-8.", | "work with encodings other than UTF-8.", | ||||
| $from_encoding, | $from_encoding, | ||||
| $to_encoding, | $to_encoding, | ||||
| 'mbstring', | 'mbstring', | ||||
| 'mbstring')); | 'mbstring')); | ||||
| } | } | ||||
| try { | |||||
| $result = @mb_convert_encoding($string, $to_encoding, $from_encoding); | $result = @mb_convert_encoding($string, $to_encoding, $from_encoding); | ||||
| } catch (ValueError $ex) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| "String conversion from encoding '%s' to encoding '%s' failed: %s", | |||||
| $from_encoding, | |||||
| $to_encoding, | |||||
| $ex)); | |||||
| } | |||||
| if ($result === false) { | if ($result === false) { | ||||
| $message = error_get_last(); | $message = error_get_last(); | ||||
| if ($message) { | if ($message) { | ||||
| $message = idx($message, 'message', pht('Unknown error.')); | $message = idx($message, 'message', pht('Unknown error.')); | ||||
| } | } | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| ▲ Show 20 Lines • Show All 261 Lines • Show Last 20 Lines | |||||