http://qs321.pair.com?node_id=1211180


in reply to Unicode path with Spreadsheet::XLSX

Files on Windows generally have a "short" name that is compatible with legacy software (i.e. DOS, Windows 3.x Applications). It is limited to the old DOS "8.3" schema and contains no spaces, no tricky characters, just a subset of printable ASCII.

Demo:

C:\>mkdir temp C:\>cd temp C:\temp>echo hi > "foo bar.batz" C:\temp>echo hello > "metäl ümläüts äre silly.öpiniön" C:\temp>dir /x Volume in drive C is System Volume Serial Number is D4F2-C5FF Directory of C:\temp 18.03.2018 10:56 <DIR> . 18.03.2018 10:56 <DIR> .. 18.03.2018 10:54 5 FOOBAR~1.BAT foo bar.batz 18.03.2018 10:56 8 METLML~1.PIN metäl ümläüts äre sil +ly.öpiniön 2 File(s) 13 bytes 2 Dir(s) 56.432.050.176 bytes free C:\temp>

Those names are not limited to legacy applications. Any application can use them, including perl:

C:\temp>perl -pe 1 foobar~1.bat metlml~1.pin hi hello C:\temp>

Another, unrelated benefit of those legacy aliases is that they tend to be shorter than the original name. This can be useful to handle files with ridiculously long names, longer than Windows' limits usually allow. See deepcopy for details.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)