From c28c3714a689eb80604bee46baa772ff435d110a Mon Sep 17 00:00:00 2001 From: Solomon Rutzky Date: Mon, 20 Nov 2023 23:19:48 -0500 Subject: [PATCH] Update class-wpdb.php to support nvarchar Add "N" prefix to quoted string substitution when preparing SQL for execution. This will change string literals to be interpreted as NVARCHAR (i.e. Unicode / UTF-16) instead of an 8-bit encoding (which changes all characters not in the associated code page to "?"s). --- wp-includes/class-wpdb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/class-wpdb.php b/wp-includes/class-wpdb.php index a22ef31e0..d3b7f519c 100644 --- a/wp-includes/class-wpdb.php +++ b/wp-includes/class-wpdb.php @@ -1635,7 +1635,7 @@ public function prepare( $query, ...$args ) { */ || ( '' === $format && '%' !== substr( $split_query[ $key - 1 ], -1, 1 ) ) ) { - $placeholder = "'%" . $format . "s'"; + $placeholder = "N'%" . $format . "s'"; } } }