diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 53e52093379cdc280384b3d8c7a245a43479ac86..b83dad5f9b3f804bd5ddf0b0615b71c0e849ec04 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -3613,7 +3613,8 @@ function gui_savepanel(cid, target, path) {
 }
 
 exports.file_dialog_callback = function(file_string) {
-    pdsend(file_dialog_target, "callback", enquote(file_string));
+    pdsend(file_dialog_target, "callback",
+        enquote(defunkify_windows_path(file_string)));
 }
 
 // Used to convert the ["key", "value"...] arrays coming from