MySQL querry via UTF8 (utf8mb4)
Posted: Wed Aug 02, 2017 8:07 pm
I've some function wich checks insert data from HTML before SQL querry sending.
But it works only for eng chars, such as latin but.. if I try to check cyrilic symbols or all symbols wich mysql supports, such as it requires in utf8mb4, is this my new regualr expression will be working, and is it will be safe for mysql queries?
p.s. I said about utf8mb4 because want to try queries with other chars in future, chinese for example but I not sure that lineage client support it thereat korean сome down
Code: Select all
// only allow alpha numeric names because we use this name on the htmls
if (!uniqueName.matches("[A-Za-z0-9]+"))
return false;
Code: Select all
// allow utf8 (4bytes)
if (!uniqueName.matches("[A-Za-z0-9\u0410-\u042f\u0430-\u044f]{3,16}"))
return false;