# wpdeepl/trunk/includes/deepl-functions.php

Translation with DeepL API, version trunk. 18 lines.

- Page: https://pluginprobe.com/plugins/wpdeepl/trunk/code/includes/deepl-functions.php
- Raw: https://pluginprobe.com/plugins/wpdeepl/trunk/raw/includes/deepl-functions.php
- Modified: 2025-12-17T06:21:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpdeepl/trunk/code/includes/deepl-functions.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
 * convert  Unicode entities
 * */
function deepl_unicode_decode( $string ) {
	$string = preg_replace_callback( '#\\\\u([0-9a-fA-F]{4})#', function ( $match ) {
			return mb_convert_encoding( pack( 'H*', $match[1] ), 'UTF-8', 'UCS-2BE' );
		}, $string );
	$string = str_replace( '\u0002', ' ', $string );
	$string = preg_replace_callback('/&#x([0-9a-fA-F]{3,4});/', function ($match) {
			return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
		}, $string);
	//$string = preg_replace_callback('/&#([0-9a-fA-F]{3,4});/', function ($match) {		    return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');		}, $string);
	return $string;
}


```
