Downloading UTF-8 filenames from an FTP-server that does not support them, with System.Net.FtpWebRequest

I have written a windows service in .Net that monitors an FTP location for new files, which it then downloads to a local folder for processing. To be precise, the tool first renames the file before downloading it. It uses the .Net standard FtpWebRequest class from System.Net. Every once in a while, a file could not be downloaded, and the FtpResponse would be 550 – Action not taken, file unavailable. This happened especially if the file name had “special characters” in it, one example being a file named ANDRÉ.XML. The workaround was simple: I’d launch an FTP application, rename the file to ANDRE.XML, and it would quickly be picked up by my tool again.

It bothered me that somehow the FTP application was able to rename the file, while FtpWebRequest was not. (It also bothered me that every once in a while I had to fix a stuck file like this, but let’s not go down that road here.) So I attached a trace log to see what was going on.
Lees meer over dit bericht

Advertenties

Downloading a video from any website

As an aside, completely unrelated to software development, last night I browsed the web and found a video on a blog that I really wanted to save to my harddrive (because you never know if the blogger might take it down later). I tried really hard (yet unsuccesful) to remember what tool I used last time to do something like that, as I realised it should be possible with all those debugging tools present on my developer system.

That, and the brilliant guide at http://geeklad.com/download-flash-video-from-any-website quickly showed how to use the unsurpassed FireBug plugin for Firefox to quickly determine the actual video file. After that, saving it to my harddrive was as easy as clicking “Save to disk”. I will not repeat the steps here, credits go to geeklad.com, just read it over there.