From 1e96e0afaf8e3d2f03353a2b39b94abada36c74f Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sat, 26 Nov 2005 14:41:56 +0100
Subject: preserve spaces in spellchecker #620

darcs-hash:20051126134156-7ad00-8ad7d27dfa1e0e2ca672065f96bb7031c34a0056.gz
---
 lib/exe/spellcheck.php | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'lib/exe')

diff --git a/lib/exe/spellcheck.php b/lib/exe/spellcheck.php
index 4bb08fd88..6d1a03910 100644
--- a/lib/exe/spellcheck.php
+++ b/lib/exe/spellcheck.php
@@ -112,6 +112,9 @@ function spell_check() {
   $string = preg_replace("/(\015\012)|(\015)/","\012",$string);
   $string = htmlspecialchars($string);
 
+  // make sure multiple spaces are kept
+  $string = preg_replace('/  /','&nbsp; ',$string);
+
   // we need the text as array later
   $data = explode("\n",$string);
 
@@ -243,6 +246,9 @@ function spell_resume(){
   // restore quoted special chars
   $text = unhtmlspecialchars($text);
 
+  // restore spaces
+  $text = preg_replace('/&nbsp;/',' ',$text);
+
   // check if UTF-8 is accepted
   if(!$_POST['utf8']){
     // protect '&' (gets removed in JS later)
-- 
cgit v1.2.3