Search code examples
androidmysqlfontskeyboardtext-recognition

Is there any way to convert stylish font to normal font in Android?


enter image description here

In my Android app i want to search users from server this works fine when i use regular Gboard or English & Indic Languages keyboard. But when i change my phone keyboard to other stylish font keyboard like above screenshot then i can't get any data from server. Same username found when search from regular keyboard.

Is there any ways to convert stylish text to normal text in android app side? OR Any change need in sql query on server side for this issue?


Solution

  • You can convert the stylish font text to its equivalent text using the following:

    Normalizer.normalize(stylishText, Normalizer.Form.NFKD)
    

    Note:
    To err on the side of caution and to remove unnecessary API calls I would suggest (in this particular case of searching) to restrict the user from entering any unwanted characters. You could specify the digits that can be inputted into the EditText like so:

    android:digits="0123456789abcdefghijklmnopqrstuvwxyz "
    

    Don't remove the space at the end so that the user can enter blank spaces