diff --git a/src/callproc.c b/src/callproc.c
index 70d144f83f..185a05af0d 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -120,14 +120,14 @@ encode_current_directory (void)
if (NILP (dir))
dir = build_string ("~");
- dir = expand_and_dir_to_file (dir, Qnil);
+ dir = expand_and_dir_to_file (remove_slash_colon (dir), Qnil);
if (NILP (Ffile_accessible_directory_p (dir)))
report_file_error ("Setting current directory",
BVAR (current_buffer, directory));
/* Remove "/:" from DIR and encode it. */
- dir = ENCODE_FILE (remove_slash_colon (dir));
+ dir = ENCODE_FILE (dir);
if (! file_accessible_directory_p (dir))
report_file_error ("Setting current directory",