Refactor #9693 When use mysql_real_escape_string, execute mysql_set_charset beforehand