| Conditions | 1 |
| Paths | 1 |
| Total Lines | 10 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public static function parseUnicode($string) |
||
| 23 | { |
||
| 24 | // uses json_decode as a hackish way to encode unicode strings |
||
| 25 | // https://stackoverflow.com/questions/6058394/unicode-character-in-php-string |
||
| 26 | |||
| 27 | // RegEx: https://regex101.com/r/yS2zX8/3 |
||
| 28 | return preg_replace_callback('/(\\\\u([0-9a-fA-F]{4}))+/', function ($match) { |
||
| 29 | return json_decode('"' . $match[0] . '"'); |
||
| 30 | }, $string); |
||
| 31 | } |
||
| 32 | |||
| 51 |