* treat filename with unknown coding set as UTF-8
authormitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Sun, 10 Mar 2013 10:08:28 +0000 (10:08 +0000)
committermitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Sun, 10 Mar 2013 10:08:28 +0000 (10:08 +0000)
git-svn-id: https://lab.mitty.jp/svn/lab/trunk@204 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

misc/save.pl

index 5c5a1db..77b6fb1 100755 (executable)
@@ -38,8 +38,16 @@ foreach my $url (@URLs) {
                 $decoder->decode($filename),
                 Encode::FB_HTMLCREF
             );
-            print ": $filename\n";
         }
+        else {
+            print "utf8?";
+            $filename = encode(
+                $coding,
+                decode("utf8", $filename),
+                Encode::FB_HTMLCREF
+            );
+        }
+        print ": $filename\n";
         
         my $suffix = 1;
         my $savename = $filename;