Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 636)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 637)
@@ -772,4 +772,9 @@
 }
 
+function _FCK_PaddingNodeListener()
+{
+	FCKDomTools.EnforcePaddingNode( FCK.EditorDocument, FCKConfig.EnterMode ) ;
+}
+
 function _FCK_EditingArea_OnLoad()
 {
@@ -779,4 +784,5 @@
 
 	FCK.InitializeBehaviors() ;
+	FCK.AttachToOnSelectionChange( _FCK_PaddingNodeListener ) ;
 	
 	// Listen for mousedown and mouseup events for tracking drag and drops.
Index: /FCKeditor/trunk/editor/_source/internals/fckdomtools.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckdomtools.js	(revision 636)
+++ /FCKeditor/trunk/editor/_source/internals/fckdomtools.js	(revision 637)
@@ -292,4 +292,42 @@
 
 		return -1 ;
+	},
+
+	PaddingNodeTag : ( new Date() ).getTime() + "_documentPadding",
+
+	EnforcePaddingNode : function( doc, tagName )
+	{
+		this.CheckAndRemovePaddingNode( doc, tagName, true ) ;
+		if ( ! doc.body.lastChild 
+				|| doc.body.lastChild.nodeType != 1 
+				|| doc.body.lastChild.tagName.toLowerCase() == tagName.toLowerCase() )
+			return ;
+		var node = doc.createElement( tagName ) ;
+		if ( FCKBrowserInfo.IsGecko && FCKListsLib.NonEmptyBlockElements[ tagName ] )
+			FCKTools.AppendBogusBr( node ) ;
+		node.id = this.PaddingNodeTag ;
+		doc.body.appendChild( node ) ;
+	},
+
+	CheckAndRemovePaddingNode : function( doc, tagName, dontRemove )
+	{
+		var paddingNode = doc.getElementById( this.PaddingNodeTag ) ;
+		if ( ! paddingNode )
+			return ;
+
+		// If the padding node is changed, remove its status as a padding node.
+		if ( paddingNode.parentNode != doc.body
+			|| paddingNode.tagName.toLowerCase() != tagName
+			|| ( paddingNode.childNodes.length > 1 ) 
+			|| ( paddingNode.firstChild && paddingNode.firstChild.nodeValue != '\xa0' 
+				&& String(paddingNode.firstChild.tagName).toLowerCase() != 'br' ) )
+		{
+			paddingNode.removeAttribute( 'id' ) ;
+			return ;
+		}
+
+		// Now we're sure the padding node exists, and it is unchanged, remove it.
+		if ( !dontRemove )
+		paddingNode.parentNode.removeChild( paddingNode ) ;
 	}
 } ;
Index: /FCKeditor/trunk/editor/_source/internals/fckxhtml.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckxhtml.js	(revision 636)
+++ /FCKeditor/trunk/editor/_source/internals/fckxhtml.js	(revision 637)
@@ -28,4 +28,5 @@
 FCKXHtml.GetXHTML = function( node, includeNode, format )
 {
+	FCKDomTools.CheckAndRemovePaddingNode( node.ownerDocument, FCKConfig.EnterMode ) ;
 	FCKXHtmlEntities.Initialize() ;
 
@@ -97,4 +98,5 @@
 		FCK.ResetIsDirty() ;
 
+	FCKDomTools.EnforcePaddingNode( node.ownerDocument, FCKConfig.EnterMode ) ;
 	return sXHTML ;
 }
