In one of our applications that is connected to facebook leads, we are getting some strange first names and last names. After some googling, I found that for some reason some people are writing their name using Mathematical Script, for example: “`𝓛𝓪𝓾𝓻𝓮𝓽𝓽𝓮““
For example the big L: https://www.compart.com/en/unicode/U+2112
Is there any way I can convert this to normal script? Without doing an comparison table?
This is a completely valid char, and we are showing them correctly due to using all mb_* string functions, so it doesn’t affect the functionality. It’s more a question of appearance than anything else.
2
Answers
Try Normalizer
You can use the Normalizer class in PHP to achieve this. Here’s a simple example of how you can normalize the text:
This will normalize the string
$originalName
into its canonical decomposition, which should convert the mathematical script characters into their regular script equivalents.