diff --git a/code/MSSQLDatabase.php b/code/MSSQLDatabase.php index 06ebd0c..7b467fa 100644 --- a/code/MSSQLDatabase.php +++ b/code/MSSQLDatabase.php @@ -1568,6 +1568,17 @@ class MSSQLDatabase extends SS_Database { } } + /** + * Overload the Database::prepStringForDB() method and include "N" prefix so unicode + * strings are saved to the database correctly. + * + * @param string $string String to be encoded + * @return string Processed string ready for DB + */ + public function prepStringForDB($string) { + return "N'" . Convert::raw2sql($string) . "'"; + } + /** * Function to return an SQL datetime expression for MSSQL * used for querying a datetime in a certain format