diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 67aa3759f5..f63dca4631 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -793,10 +793,11 @@ sub write_gcode { } else { Slic3r::open(\$fh, ">", $file) or die "Failed to open $file for writing\n"; + + # enable UTF-8 output since user might have entered Unicode characters in fields like notes + binmode $fh, ':utf8'; } - # enable UTF-8 output since user might have entered Unicode characters in fields like notes - binmode $fh, ':utf8'; # write some information my @lt = localtime;