in reply to opening files with tk getOpenFile

ActiveState decided it was better to use the ANSI APIs for files. However, the Unicode version still exists, they just disabled respecting that flag. Recompile yourself and you can use file names in all their glory. I had to do that to make a backup program keep working after I got a new version from AS.

The File API's in Windows don't even use the ANSI code page (e.g. Latin-1). They use the "OEM" code page, like DOS did. So some characters encode differently. The '£' in Windows 1252 A3 (and this is different from ISO 8859-1). That byte in Code Page 437 is the LATIN SMALL LETTER U WITH ACUTE, "ú". So Perl converts the internal string to code page 1252 (if it was of the Unicode persuasion) and codes an A3 byte where you put '£'. Then it calls the Windows API function ending with -A, which is taking its argument in code page 437, and thinks the A3 byte is a 'ú', which it converts into UTF-16LE (U+00FA) to pass to the -W version of that function, which is unambiguously Unicode and is certain you meant 'ú'.

You can also call a Windows function SetFileApisToANSI, using the Win32 module to call the Kernel32 DLL, and see if that helps. At least it removes this layer of obfuscation.

—John

Replies are listed 'Best First'.
Re^2: opening files with tk getOpenFile
by skywalker (Beadle) on May 11, 2009 at 15:29 UTC
    Thanks for the responses ill have a play around.