Open a file in a folder with Unicode name in Windows

I have a folder on my Windows 7 computer called "フ ォ ル ダ". There, the file in it is called "foo.txt", and I put several lines of text in it. I am trying to read this, which seems to be a very sticky problem. The answer to the question was an easy way to open the file:

use utf8; use Encode::Locale; use Encode; my $path = 'C:\Users\my name\Desktop\logrus_workspace\フォルダ\foo.txt'; my $new_path = encode(locale_fs => $path); print $new_path; open my $fh, '<', $new_path or die $!; 

The open call ends with an Invalid argument . Any idea what specific problem this message points to, and how can I open this file with a name in unicode?

+4
source share

Source: https://habr.com/ru/post/1499490/


All Articles