0

Does somewhere exist a list with all Perl operators and functions which expect their string arguments as octets?

For example the file test operators need octets ( Question about pathname encoding comment ).

Now I found a code with symlink and I am not sure if I should encode the file names.

Community
  • 1
  • 1
sid_com
  • 24,137
  • 26
  • 96
  • 187

1 Answers1

1

It’s simply because the traditional Unix syscalls that Perl either uses or emulates are all defined in terms of bytes, not characters. If you want a UTF-8 encoded or decoded filename, then you have to do that for yourself. You will not get what you want if you do not.

tchrist
  • 78,834
  • 30
  • 123
  • 180
  • it feels weird - I've never seen a code like this `open my $fh, '>', encode( 'utf8', 'my_filename' )` – sid_com Sep 26 '11 at 16:19
  • 1
    sid_com: Hardcoding the FS encoding results in highly system-specific code. Factor this out to make it portable, and use PerlIO::fse to detect the encoding. – daxim Sep 26 '11 at 17:36