diff --git a/typo3/sysext/t3editor/classes/class.tx_t3editor.php b/typo3/sysext/t3editor/classes/class.tx_t3editor.php
index 46f4f0b576c986e4e357d5a03c7cad7652d58bd7..b9b03ce4582850ec575cbeb96ddf92c898fd348b 100644
--- a/typo3/sysext/t3editor/classes/class.tx_t3editor.php
+++ b/typo3/sysext/t3editor/classes/class.tx_t3editor.php
@@ -224,7 +224,11 @@ class tx_t3editor implements t3lib_Singleton {
 			)
 		);
 		$T3Editor_template = addslashes($T3Editor_template);
-		$T3Editor_template = str_replace(LF, "' + '", $T3Editor_template);
+		$T3Editor_template = str_replace(
+			array(CR, LF),
+			array('', "' + '"),
+			$T3Editor_template
+		);
 
 		return '\'' . $T3Editor_template . '\'';
 	}