From: HyP3r Date: Fri, 18 Mar 2022 20:08:25 +0000 (+0100) Subject: MS SQL: Prefix Unicode strings with 'N' so they are treated correctly X-Git-Tag: v4.16.0~66 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=4bc9a29f3e24d2fb38f54338a5011f1ff524d716;p=adminer.git MS SQL: Prefix Unicode strings with 'N' so they are treated correctly --- diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php index ae2cd576..baa1b5b0 100644 --- a/adminer/drivers/mssql.inc.php +++ b/adminer/drivers/mssql.inc.php @@ -40,7 +40,8 @@ if (isset($_GET["mssql"])) { } function quote($string) { - return "'" . str_replace("'", "''", $string) . "'"; + $unicode = strlen($string) != strlen(utf8_decode($string)); + return ($unicode ? "N" : "") . "'" . str_replace("'", "''", $string) . "'"; } function select_db($database) { @@ -163,7 +164,8 @@ if (isset($_GET["mssql"])) { } function quote($string) { - return "'" . str_replace("'", "''", $string) . "'"; + $unicode = strlen($string) != strlen(utf8_decode($string)); + return ($unicode ? "N" : "") . "'" . str_replace("'", "''", $string) . "'"; } function select_db($database) {