Posted by Zog in SWF Studio V3 on May 23 2008, 05:19 am

I want to download a file with HTTP plugin which has spanish characters in its name but it's not possible. If I eliminate them, it downloads fine. I've tried with

ssCore.HTTP.headers({headers: "Content-Type: application/octet-stream; charset=utf-8\r"});
but nothing.
I don't know what to do.
Thanks in advance.

Posted by Dan in SWF Studio V3 on May 23 2008, 09:28 am

What version and build number of SWF Studio are you using?

What version of the HTTP plugin are you using?

Can you give me an example of a file name that doesn't work?

Posted by Zog in SWF Studio V3 on May 23 2008, 11:22 am

I use Flash 8, SWF Studio 3.5 Build 273 and HTTP plugin version is 3.5.1.Any file name with accent (á,ú,ó etc. like Juán.pdf, Pérez.xls ) or with spanish n with tilde above (ñ) can´t download.

Posted by Dan in SWF Studio V3 on May 23 2008, 12:45 pm

Build 273 was a Beta version. I recommend you try with the latest, release version.

Posted by Zog in SWF Studio V3 on May 25 2008, 06:22 pm

I've tried with the latest 3.5 build 314 and nothing, such files don't download.

Posted by Dan in SWF Studio V3 on May 26 2008, 08:48 am

Can you verify that you can get at those files manually, though Internet Explorer (or your favourite browser)? My tests with extended characters worked, unless the server's file system itself was unable to accept those characters in the file name. For example, the accented a,e,i,o,u, and n worked fine, but Kanji characters were replaced with question marks, on the server, so pulling those down with the http plugin failed since the name no longer matched.

Posted by Dan in SWF Studio V3 on May 26 2008, 09:41 am

To clarify my post above, the question mark issue I mentionned occured when I was copying the file to the web server (ftp, using Explorer), not when downloading the file. Once a file was on the server, with accented characters, I was able to retrieve it.

Do you have a URL I can test with? I'm unable to make it fail here.

Posted by Zog in SWF Studio V3 on May 29 2008, 06:50 am

After hours and hours of testing I found what is the problem but I don´t know why.
I can´t download files with accented characters if I use before LoadVars.sendAndLoad method. That´s it.
In first frame, button executes sendAndLoad to server and after receiving confirmation var goes and stops in second frame where I use your script for multiple downloads which works good:


ssDefaults.synchronousCommands = true;

var files:Array = [{resource: "/ab/clients/Juán.xls", name: "Juán.xls", localName: "Juán.xls"}];

var totalFiles = files.length;
var fileProgress = new Array();

var fileSizes = new Array();
var totalBytesDownloaded = 0;
var totalBytes = 0;

if(files.length > 1){
var fajlbrowse = "Juán.xls...";
var fajlbrowse = files[0].localName;

function onBrowseup()
ssCore.App.showFileSave({ caption:"Guardar en",filter:"Todos los archivos|*.*||",filename: fajlbrowse, path:"startdir://" }, {callback:"goo"});

var adr;

function goo(r,c,e){
if (r.success && r.result != ''){
var atr = r.result;

var du = fajlbrowse.length + 1;
var num = Number(atr.length) - Number(du);
adr = atr.substr(0,num);



function startDownload(p_num) {
   ssDebug.trace("Starting to download: " + files[p_num].name);
   ssCore.Plugin.load({plugin: 'HTTP', alias: 'Download' + p_num}); 
   var p = ssCore['Download' + p_num]; 
   p.protocol({protocol: 'HTTP'});{host: ''});
   p.resource({resource: files[p_num].resource});
   p.local({path: adr + "\\" + files[p_num].localName});

   p.setNotify({event: 'onProgress'}, {callback: 'onDownloadProgress', scope: this, num: p_num});
   var r = p.start({});
   if (r.success) {
      p.getContentLength({}, {callback: "onGotLength", scope: this, num: p_num}); 
   } else {
      ssDebug.trace("No start..." + r.Error.description);
      ssCore.App.showMsgBox({prompt: "Error starting download: " + files[p_num].name + ": " + r.Error.description});

function onGotLength(r, c, e) {
      if (r.success) {
        ssDebug.trace("Got file length for " + files[c.num].name + ": " + r.result);
         totalBytes += Number(r.result);
       if (c.num < totalFiles) {
       } else {
{}, {callback: "onFileDone", scope: this, num: 0});
      } else {
        ssDebug.trace("No size..." + r.Error.description);
         ssCore.App.showMsgBox({prompt: "Error retrieving filesize for: " + files[c.num].name + ": " + r.Error.description});

function onFileDone(r, c, e) : Void {
   if (r.success) {
      ssCore["Download" + c.num].stop({});
      if (c.num < totalFiles) {
         ssCore["Download" + c.num].read({}, {callback: "onFileDone", scope: this, num: c.num});
      } else {
                  ssCore.App.showMsgBox({prompt: "Look ma!  All done!"}, {sync: false}); 
   } else {
      ssDebug.trace("No Download..." + r.Error.description);
      ssCore.App.showMsgBox({prompt: "Error downloading file number: " + c.num}); 

function onDownloadProgress(r,c,e) {
   var bytes = Number(r.result);
   fileProgress[c.num] = bytes;
   totalBytesDownloaded = 0;
   for (var i = 0; i <= c.num; i++) { // fixed this too
      totalBytesDownloaded += fileProgress[i];
   setFileProgress(bytes, fileSizes[c.num]);
   setOverallProgress(totalBytesDownloaded, totalBytes);


function setFileProgress(bytes, total) {
//   ssDebug.trace("File progress: " + bytes + " / " + total);
   file_pgb.setProgress(bytes, total);

function setOverallProgress(bytes, total) {
//   ssDebug.trace("Overall progress: " + bytes + " / " + total);   
   overall_pgb.setProgress(bytes, total);
btn.onRelease = function(){

And this fails on onGotLength(). If I don´t use sendAndLoad in first frame and just gotoAndStop(2), the code downloads the file(s). It affects only files with accented characters, all others download without problem.
Why sendAndLoad affects ssCore.HTTP download I don´t know, and I don´t know if it´s a bug of SWF Studio but I made dozens of tests and this is a result. You can try it yourself and see if it happens to you, just simple sendAndLoad.
By the way, I have XP Home Edition with IE 7. IE 7 has checked (in advanced options) by default "send urls with UTF-8" and with that you can´t download a file directly from url using IE, you must uncheck the option and then it downloads "Juán.xls" from server. But this option of IE 7 DOESN´T affect at all the problem with ssCore.HTTP download mentioned above, I just put it as additional information.

Posted by mbd in SWF Studio V3 on May 29 2008, 10:22 am

Have you tried displaying what you are sending to the ssCore.HTTP.resource method?

Create a textfield that you can access from your code. I'll just call it status_txt:

status_txt.text = 'resource:'+files[p_num].resource;

Do you see what you would expect to see for the resource?

Do you see something like this?:

Or is it more like this?:

Posted by Dan in SWF Studio V3 on May 29 2008, 10:56 am


That does seem to be odd behaviour. Could you provide us with the complete resource name you're trying to retrieve? If you don't want to make this information public, email it to and mention this post.

With your information, we might be able to reproduce the problem, and that's the first step at solving it.

Posted by Zog in SWF Studio V3 on May 29 2008, 01:43 pm

The resource is ok, it's not urlencoded, I've just sent you an email with .fla file with connection to my server and the file.

Posted by Zog in SWF Studio V3 on Jun 02 2008, 06:39 pm

Did you receive my email and try to download the file?

Posted by northcode in SWF Studio V3 on Jun 02 2008, 10:22 pm

Dan might have grabbed it, but I haven't seen it. Can you send it one more time just in case the spam filter got it? I'll keep an eye open for it.

Posted by Zog in SWF Studio V3 on Jun 03 2008, 03:59 am

I send you an email again with as attachment.
The email subject is: Post with file " I can't download a file with special characters"

Posted by northcode in SWF Studio V3 on Jun 03 2008, 08:31 am

I found it in the spam folder, I've added you to our approved sender list now so we shouldn't run into this again. We'll have a look at this today.

Posted by Zog in SWF Studio V3 on Jun 06 2008, 07:12 am

Any results? Is the problem so hard to resolve?