Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Bah! sorry about that ( a bug, the program relied on a pre-existing utfnamelist.txt ), try this

#!/usr/bin/perl -- use strict; use warnings; use Path::Class; use File::Slurp; use Data::Dump; use Win32::Unicode::File; our $thisf = file(__FILE__)->absolute; our $thisd = $thisf->dir; our $tmp = 'fafafa'; chdir $thisd or die sprintf q/ERRRR(%d)(%s)(%d)(%s)/, $!,$!,$^E,$^E; mkdir $tmp or die sprintf q/ERRRR(%d)(%s)(%d)(%s)/, $!,$!,$^E,$^E; chdir $tmp or die sprintf q/ERRRR(%d)(%s)(%d)(%s)/, $!,$!,$^E,$^E; my $names = file('utfnamelist.txt')->absolute; #~ my $bin = read_file( $names, { binmode => ':raw' } ) ; dd $bin; my $bin = "\xEF\xBB\xBF# a utf-8 file-o kebab's\r\nutfnamelist.txt +\xD1\x9B\xD0\xB5\xD0\xB2\xD0\xB0\xD0\xBF.txt\r\n\xD1\x9B\xD0\xB5\xD0\ +xB2\xD0\xB0\xD0\xBF.txt ra\xC5\xBEnji\xC4\x87.txt\r\nra\xC5\ +xBEnji\xC4\x87.txt \xC4\x87evap.txt\r\n\xC4\x87evap.txt + \xD0\xBA\xD0\xB5\xD0\xB1\xD0\xB0\xD0\xBF\xD1\x87\xD0\xB5.txt\r\n\x +D0\xBA\xD0\xB5\xD0\xB1\xD0\xB0\xD0\xBF\xD1\x87\xD0\xB5.txt keb +abNOMORE.txt\r\n"; write_file( $names->basename, \$bin ); binmode STDOUT, ':encoding(UTF-8)';print "\x{feff}";#BOM ddir(); open my($fh), '<:encoding(UTF-8)', \$bin or die sprintf q/ERRRR(%d)(%s +)(%d)(%s)/, $!,$!,$^E,$^E; while(<$fh>){ next if $. == 1; # /#/; my( $here, $there ) = split /\s+/, $_; next unless $here and $there; print "# moveW $here => $there\n"; #~ dd [ $here, $there ]; moveW( $here, $there ) or die sprintf q/ERRRR(%d)(%s)(%d)(%s)/, $ +!,$!,$^E,$^E; ddir(); } chdir '..'; dir($tmp)->rmtree("verbose","cautious"); sub ddir { my $dir = `cmd /x /c "dir /b "`;; #~ use Encode::Detective qw' detect '; #~ warn detect($dir) ; # "UTF-8" utf8::decode($dir); print "# dir # ", $dir ; }

In reply to Re^5: rename to UTF8 filename by Anonymous Monk
in thread rename to UTF8 filename by exilepanda

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (2)
    As of 2018-05-25 01:31 GMT
    Find Nodes?
      Voting Booth?