FTP or HTTP Download with UTF8

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
zinnsoldat08468
Posts: 7
Joined: Wed Apr 24, 2013 2:17 pm

FTP or HTTP Download with UTF8

Post by zinnsoldat08468 »

Hello,

i woult like to Download a File from FTP but if the filename "ä,ü,ö or ß" than the Download has 0 kb.

Code: Select all

   # Generate local Path
   put "binfile:" & tAppPath & "/" & tFileName into tFileFolder

   # Generate FTP Link
   put "ftp://"& tUser & ":" & tPass & "@" & tIp & ":21/Alfresco/Sites/tür.pdf" into tFTPDownload

   # Download File
   put URL tFTPDownload into URL tFileFolder
This works for file "tuer.pdf" but if i download "tür.pdf" it dosn`t work. Please help me :-)

Regards
Z!nni
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: FTP or HTTP Download with UTF8

Post by jmburnod »

Hi Zinni,

You maybe need use urlencode()
Try this:

Code: Select all

put urlencode("tür.pdf") into tNameUrl
put "ftp://"& tUser & ":" & tPass & "@" & tIp & ":21/Alfresco/Sites/" & tNameUrl into tFTPDownload
Best regards
Jean-marc
https://alternatic.ch
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: FTP or HTTP Download with UTF8

Post by Klaus »

Hallo Herr Zinnsoldat :D

although it should, maybe the server does not even support this "modern" stuff like UTF8 filenames?
Check this: https://wiki.filezilla-project.org/Character_Set

Did you check with a dedicated FTP client?


Best

Klaus
zinnsoldat08468
Posts: 7
Joined: Wed Apr 24, 2013 2:17 pm

Re: FTP or HTTP Download with UTF8

Post by zinnsoldat08468 »

Thanks Jean-marc but "urlencode" dosn`t work for me.

@Klaus - hallo zurück :-)

i have checked with Filezilla and here is the output:

Code: Select all

Antwort:	215 UNIX Type: Java FTP Server
Befehl:	FEAT
Antwort:	211-Features supported
Antwort:	 MFMT
Antwort:	 SIZE
Antwort:	 UTF8
Antwort:	 MLST size*;modify*;create*;type*;unique*;perm*;media-type*;
Antwort:	 MLSD
Antwort:	 AUTH TLS
Antwort:	211 END
Befehl:	OPTS UTF8 ON
Antwort:	200 OPTS UTF8 ON
Filezilla use "OPTS UTF8 ON" but what can i do, to work with this server?

Regards
Z!nni
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: FTP or HTTP Download with UTF8

Post by Klaus »

Hi Zinni,

sorry, not the slightest idea...


Best

Klaus
zinnsoldat08468
Posts: 7
Joined: Wed Apr 24, 2013 2:17 pm

Re: FTP or HTTP Download with UTF8

Post by zinnsoldat08468 »

German Umlauts are bad :-)
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: FTP or HTTP Download with UTF8

Post by Klaus »

zinnsoldat08468 wrote:German Umlauts are bad :-)
Ich sachet Dir! :D
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: FTP or HTTP Download with UTF8

Post by jacque »

I don't know if this will work, but you could try converting the file path to UTF8:

Code: Select all

put unidecode(uniencode(tFilePath), "UTF8") into tFilePath
After that, you may need to urlEncode it also.

This method is for versions of LC before 7.0. If you are using 7.0 then you probably want the textEncode command instead (see the dictionary.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
zinnsoldat08468
Posts: 7
Joined: Wed Apr 24, 2013 2:17 pm

Re: FTP or HTTP Download with UTF8

Post by zinnsoldat08468 »

Thank you very much. "textEncode" has work.

Code: Select all

# Generate FTP Link
put textEncode("ftp://"& tUser & ":" & tPass & "@" & tIp & ":21/Alfresco/Sites/tür.pdf,"UTF-8") into tFTPDownload
Post Reply