Re: Doubleclick and @ARGV
[email protected] (Shawn H Corey) Mon, 13 Jan 2025 17:42:11 -0500
| Newsgroups | perl.wxperl.users |
|---|---|
| Message-ID | <[email protected]> |
--------------nB9WkhYp2ZzFLPu8R4iqsaN8
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
On 2025-01-13 16:45, Johan Vromans wrote:
> A question for Windows experts.
>
> I have installed a wxPerl application and associated it with files with
> extension '.cho'.
>
> When I doubleclick in the Explorer on such a file, my program is started
> and gets the name of the file passed via @ARGV. Well, more or less...
>
> I have a folder (on an NTFS filesystem) with three files:
>
> asciiname.cho
> namewitháccent.cho
> namewith♡unicode.cho
>
> From within the program, I can open the file if I dclick the first and the
> second name, but not the third name.
>
> What **exactly** is passed in @ARGV when I dclick these files?
> Since the filesystem is NTFS, I would expect a filename in UTF-16LE but
> when I dump the content of @ARGV (using charnames to avoid encoding issues)
> I get
>
> "asciiname.cho" -- apparently ASCII
>
> "namewith\N{LATIN SMALL LETTER WITH ACUTE}ccent.cho" -- apparently UTF8
>
> "namewith?unicode.cho" -- ????
>
> Anyone have an idea what I'm doing wrong?
I think you have to decode the file names.
use Encode qw(decode);
my $file = decode($ARGV[0]);
--
𝑆𝒉𝒂𝒘𝒏 𝐻 𝐶𝒐𝒓𝒆𝒚 🇨🇦
--------------nB9WkhYp2ZzFLPu8R4iqsaN8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 2025-01-13 16:45, Johan Vromans
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:[email protected]">
<pre class="moz-quote-pre" wrap="">A question for Windows experts.
I have installed a wxPerl application and associated it with files with
extension '.cho'.
When I doubleclick in the Explorer on such a file, my program is started
and gets the name of the file passed via @ARGV. Well, more or less...
I have a folder (on an NTFS filesystem) with three files:
asciiname.cho
namewitháccent.cho
namewith♡unicode.cho
From within the program, I can open the file if I dclick the first and the
second name, but not the third name.
What **exactly** is passed in @ARGV when I dclick these files?
Since the filesystem is NTFS, I would expect a filename in UTF-16LE but
when I dump the content of @ARGV (using charnames to avoid encoding issues)
I get
"asciiname.cho" -- apparently ASCII
"namewith\N{LATIN SMALL LETTER WITH ACUTE}ccent.cho" -- apparently UTF8
"namewith?unicode.cho" -- ????
Anyone have an idea what I'm doing wrong?
</pre>
</blockquote>
<br>
I think you have to decode the file names.<br>
<br>
use Encode qw(decode);<br>
my $file = decode($ARGV[0]);<br>
<br>
<pre class="moz-signature" cols="72">--
𝑆𝒉𝒂𝒘𝒏 𝐻 𝐶𝒐𝒓𝒆𝒚 🇨🇦</pre>
</body>
</html>
--------------nB9WkhYp2ZzFLPu8R4iqsaN8--