How to handle UTF8 characters like "é" within the URL in SHELL SCRIPT?

Discussion in 'Command Line' started by Praveen, Jul 11, 2013.

  1. Praveen

    Praveen New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi All,

    There are many image URLs in a .TXT file and I am downloading and renaming the downloaded file, within in a LOOP. As long as the photo file name is in English everything is working fine. But when the UTF8 characters like "é" or "à" are present in the file name, shell script is just ignoring the download and the renaming activity. I think even the curl command is not able to ping URL with such special characters.

    How can I handle such file names?

    Please help.


    Thanks in advance.

    Regards
    Praveen
  2. KenJackson

    KenJackson Active Member

    Messages:
    129
    Likes Received:
    27
    Trophy Points:
    28
    You have to percent-encode the UTF-8 byte sequence.

    I just experimented by renaming a file on my server to a name with an í (accented i) character and then viewing the directory with my browser and capturing the URL. It represented the character as %c3%ad. I was able to use curl to fetch it like that.

Share This Page