MySQL 8.4 C API Developer Guide
Do not use this function.
mysql_escape_string()
does not
have arguments that enable it to respect the current character
set or the quoting context. Use
mysql_real_escape_string_quote()
instead.