MySQL 8.4 C API Developer Guide

5.4.17 mysql_escape_string()

Note

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.