-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Problem Description
I encountered a FormatException error while using the dartssh2 library for SFTP operations when directories contain filenames with special characters. The error message is as follows:
''' sh
FormatException: Unexpected extension byte (at offset 1)
#0 _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1747:7)
#1 Utf8Decoder.convert (dart:convert/utf.dart:351:42)
#2 Utf8Codec.decode (dart:convert/utf.dart:63:20)
#3 SSHMessageReader.readUtf8 (package:dartssh2/src/ssh_message.dart:75:17)
...
This issue seems to occur when trying to decode byte data into a UTF-8 string. The problem arises if filenames in the directory do not conform to the UTF-8 encoding standard.
Steps to Reproduce
Connect to an SFTP server.
Try to list a directory containing non-UTF-8 encoded filenames.
Observe the FormatException error.
Expected Behavior
The dartssh2 library should be able to handle filenames with special characters, even if they are not UTF-8 encoded, without throwing an exception.
Request
Please consider adding support for non-UTF-8 encoded filenames, or provide a way to gracefully handle these cases, such as using replacement characters for parts that cannot be decoded.