]> git.donarmstrong.com Git - perltidy.git/commitdiff
update to work correctly with utf8 files
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 12 Jul 2021 01:29:57 +0000 (18:29 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 12 Jul 2021 01:29:57 +0000 (18:29 -0700)
dev-bin/side_comment_test.pl

index 5daeec4a9aa3bd4d646b91baee8f2d823eacaa41..13e22763d991f974499657d99f928b828a12748e 100755 (executable)
@@ -122,6 +122,9 @@ sub add_side_comments {
 sub write_file {
     my ( $fname, $string, $msg ) = @_;
     open my $fh, '>', $fname or die "cannot open $fname: $!\n";
+    if ( utf8::is_utf8($string) ) {
+        binmode $fh, ":raw:encoding(UTF-8)";
+    }
     $fh->print($string);
     $fh->close();
     print STDERR "Wrote $fname\n" if ($msg);