paste url into terminal(urxvt, zsh) failed, some characters get escaped

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite
2












In recent months, I find that if I copy the url in chrome and then Shift Insert in the urxvt, the pasted url is escaped.



For example, the original url is:



http://example.com/?a=c


the pasted content is:



http://example.com/?a=c


But if I paste it into other places, such as in the web browser or in the vim, there is no escape.



What I use is arch linux, urxvt, zsh, oh-my-zsh.







share|improve this question






















  • That sounds like url-quote-magic has been passed to autoload, though with the buggy mess that is oh-my-zsh, I couldn't say where it might have been set.
    – thrig
    Jul 2 '16 at 15:06










  • You want that it will be never escaped at all when you post it in the shell?
    – phk
    Jul 2 '16 at 15:08














up vote
7
down vote

favorite
2












In recent months, I find that if I copy the url in chrome and then Shift Insert in the urxvt, the pasted url is escaped.



For example, the original url is:



http://example.com/?a=c


the pasted content is:



http://example.com/?a=c


But if I paste it into other places, such as in the web browser or in the vim, there is no escape.



What I use is arch linux, urxvt, zsh, oh-my-zsh.







share|improve this question






















  • That sounds like url-quote-magic has been passed to autoload, though with the buggy mess that is oh-my-zsh, I couldn't say where it might have been set.
    – thrig
    Jul 2 '16 at 15:06










  • You want that it will be never escaped at all when you post it in the shell?
    – phk
    Jul 2 '16 at 15:08












up vote
7
down vote

favorite
2









up vote
7
down vote

favorite
2






2





In recent months, I find that if I copy the url in chrome and then Shift Insert in the urxvt, the pasted url is escaped.



For example, the original url is:



http://example.com/?a=c


the pasted content is:



http://example.com/?a=c


But if I paste it into other places, such as in the web browser or in the vim, there is no escape.



What I use is arch linux, urxvt, zsh, oh-my-zsh.







share|improve this question














In recent months, I find that if I copy the url in chrome and then Shift Insert in the urxvt, the pasted url is escaped.



For example, the original url is:



http://example.com/?a=c


the pasted content is:



http://example.com/?a=c


But if I paste it into other places, such as in the web browser or in the vim, there is no escape.



What I use is arch linux, urxvt, zsh, oh-my-zsh.









share|improve this question













share|improve this question




share|improve this question








edited Jul 2 '16 at 23:48









Gilles

506k11910011528




506k11910011528










asked Jul 2 '16 at 14:17









宇宙人

1362




1362











  • That sounds like url-quote-magic has been passed to autoload, though with the buggy mess that is oh-my-zsh, I couldn't say where it might have been set.
    – thrig
    Jul 2 '16 at 15:06










  • You want that it will be never escaped at all when you post it in the shell?
    – phk
    Jul 2 '16 at 15:08
















  • That sounds like url-quote-magic has been passed to autoload, though with the buggy mess that is oh-my-zsh, I couldn't say where it might have been set.
    – thrig
    Jul 2 '16 at 15:06










  • You want that it will be never escaped at all when you post it in the shell?
    – phk
    Jul 2 '16 at 15:08















That sounds like url-quote-magic has been passed to autoload, though with the buggy mess that is oh-my-zsh, I couldn't say where it might have been set.
– thrig
Jul 2 '16 at 15:06




That sounds like url-quote-magic has been passed to autoload, though with the buggy mess that is oh-my-zsh, I couldn't say where it might have been set.
– thrig
Jul 2 '16 at 15:06












You want that it will be never escaped at all when you post it in the shell?
– phk
Jul 2 '16 at 15:08




You want that it will be never escaped at all when you post it in the shell?
– phk
Jul 2 '16 at 15:08










3 Answers
3






active

oldest

votes

















up vote
5
down vote













This is a Z Shell module known as "url-quote-magic" in action. It is trying to ensure that you end up with what you intended even though you completely ignored shell metacharacters and quoting. It detects when (in ZLE) an unquoted word looks like a URL, with a schema on the front, and changes the way that character self-insertion happens to the rest of the word.



If the paste operation had simply entered


http://example.com/?a=c
into the command-line editor, you would have ended up with a command that when run would have tried to perform filename expansion and fail to execute because no filenames matched. A well-known example by Vivek Verma is:
~$ mpv https://www.youtube.com/watch?v=HcgJRQWxKnw
zsh: no matches found: https://www.youtube.com/watch?v=HcgJRQWxKnw
~$


Remember: The Z Shell has a lot of filename expansion characters — not only including ?, [, ], and *; but also = (command name search), < and > (number ranges), ~, ^, and #. And that's not even including the Korn shell compatibility mechanisms. See the zshexpn manual page for the quite lengthy details.



url-quote-magic determined that this wasn't a quoted word, recognized the http: schema prefix, and changed the ? and = into ? and = so that they wouldn't invoke filename expansion.



So unless you actually want, for some reason, URLs that you've pasted or typed in (without your adding any enclosing single quotes, note) to be subject to all of the filename expansions and either fail to work or (in the rare extreme surprise case) produce unexpected matches, you should probably be glad that this automatic quoting of shell metacharacters in what you clearly think of as URLs is being done for you. ☺






share|improve this answer




















  • Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
    – å®‡å®™äºº
    Jul 2 '16 at 16:13

















up vote
2
down vote













The place to look is with oh-my-zsh and its use (or not) of the safe-paste plugin:




  • The safe-paste plugin does not make pasting safe and breaks other features. #1742 comments


    Enabling this plugin also breaks the escaping of special characters that are pasted including those of URLs.




  • Keyboard input disabled after paste #4434

  • Debian Bug report logs - #802581
    zsh: url-quote-magic no longer works when pasting URL's

From these and similar reports, it seems that url-quote-magic was broken by changes to not use the bracketed-paste feature. You probably should open a bug report in the appropriate place.






share|improve this answer



























    up vote
    0
    down vote













    The text is shown escaped, but the command does not get affected by those escapes. If you test that URL with any command like curl, wget, or even google-chrome, you will find that it will work without any issue.






    share|improve this answer




















    • No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
      – å®‡å®™äºº
      Nov 7 '16 at 2:00










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f293472%2fpaste-url-into-terminalurxvt-zsh-failed-some-characters-get-escaped%23new-answer', 'question_page');

    );

    Post as a guest






























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    5
    down vote













    This is a Z Shell module known as "url-quote-magic" in action. It is trying to ensure that you end up with what you intended even though you completely ignored shell metacharacters and quoting. It detects when (in ZLE) an unquoted word looks like a URL, with a schema on the front, and changes the way that character self-insertion happens to the rest of the word.



    If the paste operation had simply entered


    http://example.com/?a=c
    into the command-line editor, you would have ended up with a command that when run would have tried to perform filename expansion and fail to execute because no filenames matched. A well-known example by Vivek Verma is:
    ~$ mpv https://www.youtube.com/watch?v=HcgJRQWxKnw
    zsh: no matches found: https://www.youtube.com/watch?v=HcgJRQWxKnw
    ~$


    Remember: The Z Shell has a lot of filename expansion characters — not only including ?, [, ], and *; but also = (command name search), < and > (number ranges), ~, ^, and #. And that's not even including the Korn shell compatibility mechanisms. See the zshexpn manual page for the quite lengthy details.



    url-quote-magic determined that this wasn't a quoted word, recognized the http: schema prefix, and changed the ? and = into ? and = so that they wouldn't invoke filename expansion.



    So unless you actually want, for some reason, URLs that you've pasted or typed in (without your adding any enclosing single quotes, note) to be subject to all of the filename expansions and either fail to work or (in the rare extreme surprise case) produce unexpected matches, you should probably be glad that this automatic quoting of shell metacharacters in what you clearly think of as URLs is being done for you. ☺






    share|improve this answer




















    • Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
      – å®‡å®™äºº
      Jul 2 '16 at 16:13














    up vote
    5
    down vote













    This is a Z Shell module known as "url-quote-magic" in action. It is trying to ensure that you end up with what you intended even though you completely ignored shell metacharacters and quoting. It detects when (in ZLE) an unquoted word looks like a URL, with a schema on the front, and changes the way that character self-insertion happens to the rest of the word.



    If the paste operation had simply entered


    http://example.com/?a=c
    into the command-line editor, you would have ended up with a command that when run would have tried to perform filename expansion and fail to execute because no filenames matched. A well-known example by Vivek Verma is:
    ~$ mpv https://www.youtube.com/watch?v=HcgJRQWxKnw
    zsh: no matches found: https://www.youtube.com/watch?v=HcgJRQWxKnw
    ~$


    Remember: The Z Shell has a lot of filename expansion characters — not only including ?, [, ], and *; but also = (command name search), < and > (number ranges), ~, ^, and #. And that's not even including the Korn shell compatibility mechanisms. See the zshexpn manual page for the quite lengthy details.



    url-quote-magic determined that this wasn't a quoted word, recognized the http: schema prefix, and changed the ? and = into ? and = so that they wouldn't invoke filename expansion.



    So unless you actually want, for some reason, URLs that you've pasted or typed in (without your adding any enclosing single quotes, note) to be subject to all of the filename expansions and either fail to work or (in the rare extreme surprise case) produce unexpected matches, you should probably be glad that this automatic quoting of shell metacharacters in what you clearly think of as URLs is being done for you. ☺






    share|improve this answer




















    • Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
      – å®‡å®™äºº
      Jul 2 '16 at 16:13












    up vote
    5
    down vote










    up vote
    5
    down vote









    This is a Z Shell module known as "url-quote-magic" in action. It is trying to ensure that you end up with what you intended even though you completely ignored shell metacharacters and quoting. It detects when (in ZLE) an unquoted word looks like a URL, with a schema on the front, and changes the way that character self-insertion happens to the rest of the word.



    If the paste operation had simply entered


    http://example.com/?a=c
    into the command-line editor, you would have ended up with a command that when run would have tried to perform filename expansion and fail to execute because no filenames matched. A well-known example by Vivek Verma is:
    ~$ mpv https://www.youtube.com/watch?v=HcgJRQWxKnw
    zsh: no matches found: https://www.youtube.com/watch?v=HcgJRQWxKnw
    ~$


    Remember: The Z Shell has a lot of filename expansion characters — not only including ?, [, ], and *; but also = (command name search), < and > (number ranges), ~, ^, and #. And that's not even including the Korn shell compatibility mechanisms. See the zshexpn manual page for the quite lengthy details.



    url-quote-magic determined that this wasn't a quoted word, recognized the http: schema prefix, and changed the ? and = into ? and = so that they wouldn't invoke filename expansion.



    So unless you actually want, for some reason, URLs that you've pasted or typed in (without your adding any enclosing single quotes, note) to be subject to all of the filename expansions and either fail to work or (in the rare extreme surprise case) produce unexpected matches, you should probably be glad that this automatic quoting of shell metacharacters in what you clearly think of as URLs is being done for you. ☺






    share|improve this answer












    This is a Z Shell module known as "url-quote-magic" in action. It is trying to ensure that you end up with what you intended even though you completely ignored shell metacharacters and quoting. It detects when (in ZLE) an unquoted word looks like a URL, with a schema on the front, and changes the way that character self-insertion happens to the rest of the word.



    If the paste operation had simply entered


    http://example.com/?a=c
    into the command-line editor, you would have ended up with a command that when run would have tried to perform filename expansion and fail to execute because no filenames matched. A well-known example by Vivek Verma is:
    ~$ mpv https://www.youtube.com/watch?v=HcgJRQWxKnw
    zsh: no matches found: https://www.youtube.com/watch?v=HcgJRQWxKnw
    ~$


    Remember: The Z Shell has a lot of filename expansion characters — not only including ?, [, ], and *; but also = (command name search), < and > (number ranges), ~, ^, and #. And that's not even including the Korn shell compatibility mechanisms. See the zshexpn manual page for the quite lengthy details.



    url-quote-magic determined that this wasn't a quoted word, recognized the http: schema prefix, and changed the ? and = into ? and = so that they wouldn't invoke filename expansion.



    So unless you actually want, for some reason, URLs that you've pasted or typed in (without your adding any enclosing single quotes, note) to be subject to all of the filename expansions and either fail to work or (in the rare extreme surprise case) produce unexpected matches, you should probably be glad that this automatic quoting of shell metacharacters in what you clearly think of as URLs is being done for you. ☺







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jul 2 '16 at 15:48









    JdeBP

    28.6k459134




    28.6k459134











    • Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
      – å®‡å®™äºº
      Jul 2 '16 at 16:13
















    • Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
      – å®‡å®™äºº
      Jul 2 '16 at 16:13















    Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
    – å®‡å®™äºº
    Jul 2 '16 at 16:13




    Do you mean that it just displays http://...?a=c and helps zsh avoids expanding. If I do something like aria2c http://...?a=c in zsh, the actual command to run is still aria2c http://...?a=c?
    – å®‡å®™äºº
    Jul 2 '16 at 16:13












    up vote
    2
    down vote













    The place to look is with oh-my-zsh and its use (or not) of the safe-paste plugin:




    • The safe-paste plugin does not make pasting safe and breaks other features. #1742 comments


      Enabling this plugin also breaks the escaping of special characters that are pasted including those of URLs.




    • Keyboard input disabled after paste #4434

    • Debian Bug report logs - #802581
      zsh: url-quote-magic no longer works when pasting URL's

    From these and similar reports, it seems that url-quote-magic was broken by changes to not use the bracketed-paste feature. You probably should open a bug report in the appropriate place.






    share|improve this answer
























      up vote
      2
      down vote













      The place to look is with oh-my-zsh and its use (or not) of the safe-paste plugin:




      • The safe-paste plugin does not make pasting safe and breaks other features. #1742 comments


        Enabling this plugin also breaks the escaping of special characters that are pasted including those of URLs.




      • Keyboard input disabled after paste #4434

      • Debian Bug report logs - #802581
        zsh: url-quote-magic no longer works when pasting URL's

      From these and similar reports, it seems that url-quote-magic was broken by changes to not use the bracketed-paste feature. You probably should open a bug report in the appropriate place.






      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        The place to look is with oh-my-zsh and its use (or not) of the safe-paste plugin:




        • The safe-paste plugin does not make pasting safe and breaks other features. #1742 comments


          Enabling this plugin also breaks the escaping of special characters that are pasted including those of URLs.




        • Keyboard input disabled after paste #4434

        • Debian Bug report logs - #802581
          zsh: url-quote-magic no longer works when pasting URL's

        From these and similar reports, it seems that url-quote-magic was broken by changes to not use the bracketed-paste feature. You probably should open a bug report in the appropriate place.






        share|improve this answer












        The place to look is with oh-my-zsh and its use (or not) of the safe-paste plugin:




        • The safe-paste plugin does not make pasting safe and breaks other features. #1742 comments


          Enabling this plugin also breaks the escaping of special characters that are pasted including those of URLs.




        • Keyboard input disabled after paste #4434

        • Debian Bug report logs - #802581
          zsh: url-quote-magic no longer works when pasting URL's

        From these and similar reports, it seems that url-quote-magic was broken by changes to not use the bracketed-paste feature. You probably should open a bug report in the appropriate place.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 2 '16 at 15:15









        Thomas Dickey

        49.5k584155




        49.5k584155




















            up vote
            0
            down vote













            The text is shown escaped, but the command does not get affected by those escapes. If you test that URL with any command like curl, wget, or even google-chrome, you will find that it will work without any issue.






            share|improve this answer




















            • No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
              – å®‡å®™äºº
              Nov 7 '16 at 2:00














            up vote
            0
            down vote













            The text is shown escaped, but the command does not get affected by those escapes. If you test that URL with any command like curl, wget, or even google-chrome, you will find that it will work without any issue.






            share|improve this answer




















            • No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
              – å®‡å®™äºº
              Nov 7 '16 at 2:00












            up vote
            0
            down vote










            up vote
            0
            down vote









            The text is shown escaped, but the command does not get affected by those escapes. If you test that URL with any command like curl, wget, or even google-chrome, you will find that it will work without any issue.






            share|improve this answer












            The text is shown escaped, but the command does not get affected by those escapes. If you test that URL with any command like curl, wget, or even google-chrome, you will find that it will work without any issue.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 5 '16 at 22:22









            camilhord

            1




            1











            • No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
              – å®‡å®™äºº
              Nov 7 '16 at 2:00
















            • No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
              – å®‡å®™äºº
              Nov 7 '16 at 2:00















            No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
            – å®‡å®™äºº
            Nov 7 '16 at 2:00




            No, not actually. Under following situation, the command gets affected. In some cases, the urls contain spaces (some urls even contain both CJK characters and spaces), so I must wrap the url with quotes and unescape all ?s back to ?s.
            – å®‡å®™äºº
            Nov 7 '16 at 2:00












             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f293472%2fpaste-url-into-terminalurxvt-zsh-failed-some-characters-get-escaped%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)