--- a/src/Editor.h
+++ b/src/Editor.h
@@ -95,6 +95,7 @@
 		characterSet = characterSet_;
 		rectangular = rectangular_;
 		lineCopy = lineCopy_;
+		FixSelectionForClipboard();
 	}
 	void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
 		delete []s;
@@ -108,9 +109,21 @@
 		characterSet = characterSet_;
 		rectangular = rectangular_;
 		lineCopy = lineCopy_;
+		FixSelectionForClipboard();
 	}
 	void Copy(const SelectionText &other) {
 		Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy);
+	}
+	
+private:
+	void FixSelectionForClipboard() {
+		// Replace null characters by spaces.
+		// To avoid that the content of the clipboard is truncated in the paste operation 
+		// when the clipboard contains null characters.
+		for (int i = 0; i < len - 1; ++i) {
+			if (s[i] == '\0')
+				s[i] = ' ';
+		}
 	}
 };