Hi!

I'm stuck here and could not find any good search keywords to answer my question. So, sorry if this is already answered elsewhere.

I'm working on a SLES Linux with UTF-8 support switched on. Given is a file which contains german umlauts in its name (e.g. 'Fehler für Projekt x.xls') The following code worked perfectly on an older SLES:

unless (opendir(DIR,$scandir)) { confess "can't open the directory $scandir: $@"; } @files=grep {-f "$scandir/$_"} readdir(DIR);
On this machine, it is possible to use
chdir ($scandir); opendir(DIR,'.'); @files=grep {-f $_} readdir(DIR);
but as soon as I concatenate the retrieved filename with some other string, e.g. "$scandir/$_" or $scandir."/".$_ or $scandir."/".$files[0], "-f" does not work any more plus I cannot copy or move $scandir."/".$files[0]. Is there any general setting that I have to do in my perl code to treat utf files correctly? I already tried "use utf8;" or 'use encoding "utf8";' but these did not make a difference.

Thanks for your help

Mike


In reply to treat files with umlauts (utf) by mike.scharnow

Title:
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, details, 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, summary, 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.