From aa5bafb8be6389f9d995797145ea94d09311616f Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Tue, 13 Jan 2015 23:19:19 +0100
Subject: [PATCH] Support preset names with Unicode characters. #2527

---
 lib/Slic3r/GUI.pm     | 1 +
 lib/Slic3r/GUI/Tab.pm | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm
index 0c7122c42..9fcb85dc6 100644
--- a/lib/Slic3r/GUI.pm
+++ b/lib/Slic3r/GUI.pm
@@ -217,6 +217,7 @@ sub presets {
     opendir my $dh, Slic3r::encode_path("$Slic3r::GUI::datadir/$section")
         or die "Failed to read directory $Slic3r::GUI::datadir/$section (errno: $!)\n";
     foreach my $file (grep /\.ini$/i, readdir $dh) {
+        $file = Slic3r::decode_path($file);
         my $name = basename($file);
         $name =~ s/\.ini$//;
         $presets{$name} = "$Slic3r::GUI::datadir/$section/$file";
diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm
index a2ff8f331..4d998a569 100644
--- a/lib/Slic3r/GUI/Tab.pm
+++ b/lib/Slic3r/GUI/Tab.pm
@@ -1390,8 +1390,8 @@ sub config {
         return Slic3r::Config->new_from_defaults(@$keys);
     } else {
         if (!-e $self->file) {
-            Slic3r::GUI::show_error($self, "The selected preset does not exist anymore (" . $self->file . ").");
-            return;
+            Slic3r::GUI::show_error(undef, "The selected preset does not exist anymore (" . $self->file . ").");
+            return undef;
         }
         
         # apply preset values on top of defaults