Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi, Problem: Reading the directory contents of a directory on a Microsoft Windowsserver 2008 SP2. The contents of the directory was created by the commandline version of 7zip while unpacking a TAR-archive, which was created on a UNIX-system. The filenames contain characters outside ASCII.

Symptoms and reason for them: The filenames were encoded in latin1 and were put as bytestrings on the filesystem of the Windowsserver and then tagged being of the encoding scheme of the Windowsserver without being altered on byte level. The command 'dir' of that directory shows the correct count of characters, but the NON-ASCII-characters are shown as 'grey blcoks'.

The same directory shown in the Windows Explorer shows them in the 8.3 scheme of DOS and an attached ~<number>. I need to read the directory with perl in the way command.com sees the directory and to fix the problem WITHOUT changing the bytes of the filename as such.

I tried many versions of encode/decode/use bytes/pack-unpack. Too many to post them here.

How can I fix that with Perl only?
Thank you very much in advance!
Best regards,
mcc


In reply to How to fix wrongly encoded filenames? by mcc001

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-26 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found