Skip to main content
New Participant
December 4, 2020
Answered

Adobe Bridge script - Download images from a URL link to a folder path with a Cyrillic name

  • December 4, 2020
  • 2 replies
  • 733 views

I am trying to download images from a URL link to a folder path with a Cyrillic name using Adobe Bridge scripting. 

Example:

 

var localImgPath = 'C:/Users/serge/Desktop/Привіт світ/new-img.png';
var imageUrl = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png';

app.system('curl -o "' + localImgPath + '" "' + imageUrl + '" pause');

 

Error:

But if the path to the saved file is entirely in Latin, the file is successfully saved. And if I write a cmd line with a Cyrillic path, it also works.

 

curl -o "C:/Users/serge/Desktop/Привіт світ/new-img.png" "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png"

 

Adobe Bridge passes incorrect path. How can this be fixed?

I am trying to embed it in a large script.

 

    This topic has been closed for replies.
    Correct answer sergeyv8093394

    I found a solution and I will answer my own question myself. Wonderful resource)

    var localImgPath = encodeURI('C:/Users/serge/Desktop/Привіт світ/new-img.png');
    var imageUrl = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png';
    
    app.system("powershell -nop -c $mypath = [Uri]::UnescapeDataString('" + localImgPath + "'); Invoke-WebRequest -Uri '" + imageUrl + "' -OutFile $mypath");

    I encoded the path with Cyrillic (encodeURI) and decoded back in powershell (escaping-text-strings) and downloaded with powershell (use-powershell-to-download-a-file)

    2 replies

    sergeyv8093394AuthorCorrect answer
    New Participant
    December 4, 2020

    I found a solution and I will answer my own question myself. Wonderful resource)

    var localImgPath = encodeURI('C:/Users/serge/Desktop/Привіт світ/new-img.png');
    var imageUrl = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png';
    
    app.system("powershell -nop -c $mypath = [Uri]::UnescapeDataString('" + localImgPath + "'); Invoke-WebRequest -Uri '" + imageUrl + "' -OutFile $mypath");

    I encoded the path with Cyrillic (encodeURI) and decoded back in powershell (escaping-text-strings) and downloaded with powershell (use-powershell-to-download-a-file)

    Brainiac
    December 4, 2020

    I suspect you may get more replies in the Bridge forum if the fault happens in Bridge scripting. When you post, be sure to say what encoding you use when saving the script file.

    New Participant
    December 4, 2020

    I am using UTF-8 encoding. With this encoding, Adobe Script understands Cyrillic.

    Bridge alert:

    But when Bridge passes the path, I get the CMD error:

    I checked all cyrillic encodings.

    But Bridge doesn't understand them.

    CMD Error:

    Perhaps I can save the file to a temporary path with Latin letters and then move it using the Adobe script, but I hope there is a solution to this problem.