Page 1 of 1

FTP charset - Optional parameter or auto detection

Posted: Fri Jun 24, 2016 8:48 am
by RSBasic
Good Morning :)

I have a problem. I download any files with ReceiveFTPFile().
Some file names contain german umlauts (ä, ö, ü) or other special characters (ß) but FTPDirectoryEntryName() shows wrong file names.
My server uses the charset UTF-8 but PureBasic receives ASCII.

My example code:

Code: Select all

EnableExplicit

InitNetwork()

If OpenFTP(1, "rsbasic.de", "webika3rg_qch3ai", "PureBasic!2016")
  If ExamineFTPDirectory(1)
    While NextFTPDirectoryEntry(1)
      Debug FTPDirectoryEntryName(1)
    Wend
  EndIf
 
  CloseFTP(1)
EndIf
I can't find the parameter to change of charset. The FTP client "FileZilla" has a charset function but PureBasic hasn't this.

I can convert the string to UTF-8 with UTF8() or with:

Code: Select all

Procedure.s AsciiToUTF8(String$)
  Protected Buffer$
 
  Buffer$ = Space(Len(String$))
  PokeS(@Buffer$, String$, -1, #PB_Ascii)
  String$ = PeekS(@Buffer$, -1, #PB_UTF8)
 
  ProcedureReturn String$
EndProcedure
But this is a workaround. :(

Can you add the charset parameter for OpenFTP() or a auto detection function?

Thank you :)

Re: FTP charset - Optional parameter or auto detection

Posted: Mon Jun 27, 2016 7:10 am
by mhs
+1

Re: FTP charset - Optional parameter or auto detection

Posted: Sat Oct 01, 2016 4:15 am
by IdeasVacuum
+1
Same issue: CreateFTPDirectory(0, "报 报 报")
Unicode characters not supported (result is ???)

Re: FTP charset - Optional parameter or auto detection

Posted: Mon Aug 28, 2017 1:28 am
by IdeasVacuum
Given that PB is Unicode now, shouldn't this issue be classed as a bug?

Re: FTP charset - Optional parameter or auto detection

Posted: Mon Aug 28, 2017 9:51 am
by Bisonte
No it's not a bug, because FTP is always ASCII : so the specification RFC959.

Other charsets are additional features of the RF959, this is RFC2640.

But on some servers the authentification with OpenFTP() failed, so I think, at the change to unicode, Fred forget the FTP lib to
make it compatible (I mean that the ftp lib send and receive ASCII).

But I support the request to add the charset option or autodetection so : +1

Re: FTP charset - Optional parameter or auto detection

Posted: Mon Aug 28, 2017 11:43 am
by IdeasVacuum
You are right Bisonte.

Re: FTP charset - Optional parameter or auto detection

Posted: Fri Mar 30, 2018 3:51 pm
by RSBasic
As long as this charset parameter does not exist, I can use my PB.Ex FTP.
Works very well with UTF-8 and has no umlaut problems.