in reply to Re^2: Character encoding in console in Windows
in thread Character encoding in console in Windows

I was hoping this problem was not inherent in CMD.exe... Are you saying that there is no way for a user to drag and drop a file with a non-ASCII name into the console window and have the perl script open that file?

To my knowledge, you've never been able to drag & drop a file into a console window and have anything happen.

It not a perl "problem". Not a cmd.exe "problem". Just something that has never been designed in. Where did you get the idea it was possible?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy
  • Comment on Re^3: Character encoding in console in Windows

Replies are listed 'Best First'.
Re^4: Character encoding in console in Windows
by elef (Friar) on Sep 11, 2010 at 20:23 UTC
    Of course it's possible, you are probably misunderstanding me. When you drop in a file, the console displays its path, and then the script can take that as input.

    So what my code does is:

    1. tell the user to drag and drop a file in the console, wait for input via STDIN
    2. user drags & drops file from file manager into console, the full filepath appears in the console, user presses enter
    3. the script stores the string with the filepath in a variable, parses it, opens the file, magic happens

    Pretty much all OSes have this functionality apart from Windows Vista (XP and Win7 have it, Vista is the only one that doesn't).

    This is pretty much the default method for cd'ing into a directory for most people... you type "cd ", drag and drop a folder and press enter... it eliminates a hell of a lot of typing.
    It works fine in my script in most scenarios, but not with accented characters on Windows.

    BTW the same will often work with URLs, depending on what browser you have and which bit you're grabbing. If you grab a photo from an open webpage, the URL of the image should appear in the console, and you can often drag & drop favicons or links etc.

      Pretty much all OSes have this functionality apart from Windows Vista

      I run Vista.

      (But I don't remember seeing this work in XP which I ran for years. But maybe I just never thought to try it?)

        Well, the whole drag-and-drop mystery has been cleared up, but there is no solution for the original issue. Can anyone help?
Re^4: Character encoding in console in Windows
by Anonymous Monk on Sep 11, 2010 at 20:20 UTC
    Try it, what happens is the filepath get pasted into the current line

      Not on my system it doesn't.

      Just to clarify. I'm dragging a file from the Explorer over a console window.

      And when I do, the cursor switches to the "no entry' sign.

      When I drop, nothing at all happens. Regardless of whether the console session is at the shell prompt awaiting input, or if there is a perl script running blocked reading from STDIN.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Hmm, well it works for me in windows 2000, xp and windows 7 ... doesn't seem to be related to quick edit or insert mode
        I've always gotten the same results as the anonymous monk: The quoted path to the file gets pasted into the console. Win2k Pro, WinXP Pro, Win7 Pro.