www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Re: SFTP character encoding and problem with agent auth

Re: SFTP character encoding and problem with agent auth

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Wed, 11 Aug 2010 23:20:34 +0100

On 11 August 2010 23:15, Alexander Lamaison <swish_at_lammy.co.uk> wrote:
> 2010/8/11 Željko Marjanović <savethem4ever_at_gmail.com>:
>> Is it possible to determine the character encoding the SSH/SFTP server is
>> using? I have read the protocol
>> specs for SFTP v3 and there is no mention of it, but in v4 default encoding
>> is UTF-8.  Is it safe to assume
>> and use UTF-8 for default encoding?
>
> I have no idea how SFTP v4 expects servers to guarantee they supply
> UTF-8 when the server doesn't even know the encoding of its own
> filenames!

Lo and behold, this is what the SFTP v6 spec says [1]:

   The preferred encoding for filenames is UTF-8. This is consistent
   with IETF Policy on Character Sets and Languages [RFC2277] and it is
   further supposed that the server is more likely to support any local
   character set and be able to convert it to UTF-8.

   However, because the server does not always know the encoding of
   filenames, it is not always possible for the server to preform a
   valid translation to UTF-8. When an invalid translation to UTF-8 is
   preformed, it becomes impossible to manipulate the file, because the
   translation is not reversible. ...

[1] http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#page-15

Alex

--
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-08-12

the libssh2 team