Index: wp-admin/plugin-editor.php
===================================================================
--- wp-admin/plugin-editor.php	(revision 20523)
+++ wp-admin/plugin-editor.php	(working copy)
@@ -52,7 +52,7 @@
 
 	check_admin_referer('edit-plugin_' . $file);
 
-	$newcontent = stripslashes($_POST['newcontent']);
+	$newcontent = str_replace( array( "\r\n", "\r" ), "\n", stripslashes( $_POST['newcontent'] ) );
 	if ( is_writeable($real_file) ) {
 		$f = fopen($real_file, 'w+');
 		fwrite($f, $newcontent);
Index: wp-admin/theme-editor.php
===================================================================
--- wp-admin/theme-editor.php	(revision 20523)
+++ wp-admin/theme-editor.php	(working copy)
@@ -85,7 +85,7 @@
 switch( $action ) {
 case 'update':
 	check_admin_referer( 'edit-theme_' . $file . $stylesheet );
-	$newcontent = stripslashes( $_POST['newcontent'] );
+	$newcontent = str_replace( array( "\r\n", "\r" ), "\n", stripslashes( $_POST['newcontent'] ) );
 	$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
 	if ( is_writeable( $file ) ) {
 		//is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
