rename not working on files with accents in names

T

Tom Bates

ActiveState perl 5.8.0 build 806 on Windows 2000 Pro...

The statement:
rename $src, $dst;
returns an error when $src is:
Tecatitlán.txt
If I remove the accented character, the rename operation succeeds.

I tried using File::Copy's move operation as well as setting
${^WIDE_SYSTEM_CALLS} to 1. Neither works.

Any suggestions?
TIA
tbone
 
C

Chris Mattern

Tom said:
ActiveState perl 5.8.0 build 806 on Windows 2000 Pro...

The statement:
rename $src, $dst;
returns an error when $src is:
Tecatitlán.txt
If I remove the accented character, the rename operation succeeds.

I tried using File::Copy's move operation as well as setting
${^WIDE_SYSTEM_CALLS} to 1. Neither works.

Any suggestions?

Print out $! to have it tell you what the error is. The obvious
one that occurs to me is that Perl doesn't think you have a file
named Tecatitlán.txt because Perl and the OS aren't using the
same character encoding scheme.
TIA
tbone

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
T

Tad McClellan

Tom Bates said:
The statement:
rename $src, $dst;
returns an error when $src is:
Tecatitlán.txt

Any suggestions?


I suggest sharing the text of the error message!
 
T

Tom Bates

Thanks for reminding me about being able to see the actual error info
(I referred to the Perl help pages for the available error variables).
After the rename fails:

$! == "No such file or directory"
$^E == "The system cannot find the file specified"
$? == 0

I have many files with other accented characters that cause the same
problem, BTW. I'm just using this one to narrow down the problem.

Thanks for the help...
tbone
 
C

Chris Mattern

Tom said:
Thanks for reminding me about being able to see the actual error info
(I referred to the Perl help pages for the available error variables).
After the rename fails:

$! == "No such file or directory"
$^E == "The system cannot find the file specified"
$? == 0

I have many files with other accented characters that cause the same
problem, BTW. I'm just using this one to narrow down the problem.

Please don't top-post. Put your reply after the text you are replying
to. That said, I firmly believe that your problem is that your Perl
program and Windows aren't using the same character set--that is,
"á" in your Perl program and "á" on your command line aren't in fact
the same character. As I very rarely need to fool with non-ASCII
character sets, I'll leave your solutions to somebody who understands
them better.
Thanks for the help...
tbone

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
C

Chris Mattern

Chris said:
Please don't top-post. Put your reply after the text you are replying
to. That said, I firmly believe that your problem is that your Perl
program and Windows aren't using the same character set--that is,
"á" in your Perl program and "á" on your command line aren't in fact
the same character. As I very rarely need to fool with non-ASCII
character sets, I'll leave your solutions to somebody who understands
them better.

It occurs to me that there is a simple test for this. Have your
Perl program create "Tecatitlán.txt". Then look at the file
in Windows. If it has a weird character instead of "á", then
that's your problem.

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top