I resolved the problem by converting the number to string before formatting the SQL query search. I suspect that on that specific device, the contacts provider implementation doesn't automatically convert the number to string, and ends up with a SQL syntax error.
I also noticed that special character keys were problematic as well. So I simply add '' to all none-character inputs