updated for version 7.0e02
diff --git a/src/getchar.c b/src/getchar.c
index 3d85165..0ba97b4 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -128,6 +128,9 @@
 static void	map_free __ARGS((mapblock_T **));
 static void	validate_maphash __ARGS((void));
 static void	showmap __ARGS((mapblock_T *mp, int local));
+#ifdef FEAT_EVAL
+static char_u	*eval_map_expr __ARGS((char_u *str));
+#endif
 
 /*
  * Free and clear a buffer.
@@ -2328,7 +2331,7 @@
 			    if (tabuf.typebuf_valid)
 			    {
 				vgetc_busy = 0;
-				s = eval_to_string(mp->m_str, NULL, FALSE);
+				s = eval_map_expr(mp->m_str);
 				vgetc_busy = save_vgetc_busy;
 			    }
 			    else
@@ -4251,7 +4254,7 @@
 	    }
 #ifdef FEAT_EVAL
 	    if (mp->m_expr)
-		s = eval_to_string(mp->m_str, NULL, FALSE);
+		s = eval_map_expr(mp->m_str);
 	    else
 #endif
 		s = mp->m_str;
@@ -4281,6 +4284,36 @@
     return FALSE;
 }
 
+#ifdef FEAT_EVAL
+/*
+ * Evaluate the RHS of a mapping or abbreviations and take care of escaping
+ * special characters.
+ */
+    static char_u *
+eval_map_expr(str)
+    char_u	*str;
+{
+    char_u	*res;
+    char_u	*s;
+    int		len;
+
+    s = eval_to_string(str, NULL, FALSE);
+    if (s == NULL)
+	return NULL;
+
+    /* Need a buffer to hold up to three times as much. */
+    len = (int)STRLEN(s);
+    res = alloc((unsigned)(len * 3) + 1);
+    if (res != NULL)
+    {
+	STRCPY(res, s);
+	(void)fix_input_buffer(res, len, TRUE);
+    }
+    vim_free(s);
+    return res;
+}
+#endif
+
 /*
  * Write map commands for the current mappings to an .exrc file.
  * Return FAIL on error, OK otherwise.