What you are getting is called a "psuedo-alphabet", you can see a list of them here: https://qaz.wtf/u/convert.cgi. The one that you appear to be getting can be seen here: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
Basically what you need to do is take the string, split it and use a lookup table to convert it back to regular characters. This implementation is terribly efficient but that's because I grabbed the alphabets from the above Wikipedia page and was too lazy to reorganise it.
function math_symbols_to_plain_text($input, $alphabet)
{
$alphabets = [
['a','','','','','','','','','','','','',''],
['b','','','','','','','','','','','','',''],
['c','','','','','','','','','','','','',''],
['d','','','','','','','','','','','','',''],
['e','','','','','','','','ℯ','','','','',''],
['f','','','','','','','','','','','','',''],
['g','','','','','','','','ℊ','','','','',''],
['h','','ℎ','','','','','','','','','','',''],
['i','','','','','','','','','','','','',''],
['j','','','','','','','','','','','','',''],
['k','','','','','','','','','','','','',''],
['l','','','','','','','','','','','','',''],
['m','','','','','','','','','','','','',''],
['n','','','','','','','','','','','','',''],
['o','','','','','','','','ℴ','','','','',''],
['p','','','','','','','','','','','','',''],
['q','','','','','','','','','','','','',''],
['r','','','','','','','','','','','','',''],
['s','','','','','','','','','','','','',''],
['t','','','','','','','','','','','','',''],
['u','','','','','','','','','','','','',''],
['v','','','','','','','','','','','','',''],
['w','','','','','','','','','','','','',''],
['x','','','','','','','','','','','','',''],
['y','','','','','','','','','','','','',''],
['z','','','','','','','','','','','','',''],
['A','','','','','','','','','','','','',''],
['B','','','','','','','','ℬ','','','','',''],
['C','','','','','','','','','','ℭ','','','ℂ'],
['D','','','','','','','','','','','','',''],
['E','','','','','','','','ℰ','','','','',''],
['F','','','','','','','','ℱ','','','','',''],
['G','','','','','','','','','','','','',''],
['H','','','','','','','','ℋ','','ℌ','','','ℍ'],
['I','','','','','','','','ℐ','','ℑ','','',''],
['J','','','','','','','','','','','','',''],
['K','','','','','','','','','','','','',''],
['L','','','','','','','','ℒ','','','','',''],
['M','','','','','','','','ℳ','','','','',''],
['N','','','','','','','','','','','','','ℕ'],
['O','','','','','','','','','','','','',''],
['P','','','','','','','','','','','','','ℙ'],
['Q','','','','','','','','','','','','','ℚ'],
['R','','','','','','','','ℛ','','ℜ','','','ℝ'],
['S','','','','','','','','','','','','',''],
['T','','','','','','','','','','','','',''],
['U','','','','','','','','','','','','',''],
['V','','','','','','','','','','','','',''],
['W','','','','','','','','','','','','',''],
['X','','','','','','','','','','','','',''],
['Y','','','','','','','','','','','','',''],
['Z','','','','','','','','','','ℨ','','','ℤ']
];
$replace = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
$lookup = [
'serif-normal',
'serif-bold',
'serif-italic',
'serif-bolditalic',
'sans-normal',
'sans-bold',
'sans-italic',
'sans-bolditalic',
'script-normal',
'script-bold',
'franktur-normal',
'fraktur-bold',
'monospace',
'doublestruck'
];
$map_index = array_search($alphabet, $lookup);
$split = mb_str_split($input);
$output = '';
foreach ($split as $char) {
foreach ($alphabets as $i => $letter) {
if ($letter[$map_index] === $char)
$output .= $replace[$i];
}
}
return $output;
}
$input = '';
$output = math_symbols_to_plain_text($input, 'serif-italic');
echo $input . PHP_EOL . $output . PHP_EOL;
Yields:
Alejandra