diff --git a/admin/lang.php b/admin/lang.php
index <HASH>..<HASH> 100644
--- a/admin/lang.php
+++ b/admin/lang.php
@@ -628,6 +628,9 @@ function lang_fix_value_before_save($value='') {
     if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") {  // Some MB languages include backslash bytes
         $value = str_replace("\\","",$value);           // Delete all slashes
     }
+    if (ini_get_bool('magic_quotes_sybase')) {          // Unescape escaped sybase quotes
+        $value = str_replace("''", "'", $value);
+    }
     $value = str_replace("'", "\\'", $value);           // Add slashes for '
     $value = str_replace('"', "\\\"", $value);          // Add slashes for "
     $value = str_replace("%","%%",$value);              // Escape % characters
Now sybase quotes are properly handled by the lang editor. Part of MDL-<I>

Merged from MOODLE_<I>_STABLE