diff --git a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
index 44c63c966689b50e1695fd5fec8b6ffd9bdfb00a..3668a1c8523986ab97cb9d09c96cc19be4c129e8 100644
--- a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
+++ b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
@@ -860,8 +860,8 @@ class TypoScriptParser {
 				}
 
 			}
-			// Not the first/last linebreak char.
-			$string = substr($newString, 1, -1);
+			// Add a line break before and after the included code in order to make sure that the parser always has a LF.
+			$string = LF . trim($newString) . LF;
 		}
 		// When all included files should get returned, simply return an compound array containing
 		// the TypoScript with all "includes" processed and the files which got included