-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding problem #22
Comments
What if you instead just change the line stream.setEncoding('utf8'); to stream.setEncoding('binary'); ? |
no, that don't work. output : |
I have the same issue |
stream.setEncoding('binary'); |
changing ftp.js encoding to utf8 the error is the same. |
@ramstein74 With the original code from master, can you set |
i solved this problem. i saw with node inspector The console error is ftp_test.js:35 in node monitor (web) tracing stops at this file line 109 debug(msecs + ' list empty'); My app is in coffee so i converted it to javascript (code below) (function() { FTPClient = require("ftp"); conn = new FTPClient(); conn.on("connect", function() { conn.connect(); }).call(this); |
Please try with the master branch now if you can and let me know how it goes. All file names should be 'binary' strings. |
i can get the file lists from the ftp, and with iconv.decode(list.name, 'gbk') I can get the correct Chinese, but the problem is how can I get the specified file lists of a folder in Chinese, like ‘/测试’ |
@lizhipower any advance on this? How did you solve this? I'm facing the same issue here. |
yeah use the raw ftp cmd
Get Outlook for iOS
On Mon, Oct 17, 2016 at 6:47 PM +0800, "Luís Gomes" <notifications@github.com> wrote:
@lizhipower any advance on this? How did you solve this? I'm facing the same issue here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@mscdex you should use Buffer with filepath, or add a encode option with method such as list, cwd etc. FTP.prototype.cwd = function (path, cb, promote) {
let cmddata = 'CWD ';
if (Buffer.isBuffer(path)) cmddata = Buffer.concat([Buffer.from(cmddata), path]);
else cmddata += path;
this._send(cmddata, function (err, text, code) {
if (err)
return cb(err);
var m = RE_WD.exec(text);
cb(undefined, m ? m[1] : undefined);
}, promote);
};
FTP.prototype._send = function (cmd, cb, promote) {
clearTimeout(this._keepalive);
if (cmd !== undefined) {
if (promote)
this._queue.unshift({
cmd: cmd,
cb: cb
});
else
this._queue.push({
cmd: cmd,
cb: cb
});
}
var queueLen = this._queue.length;
if (!this._curReq && queueLen && this._socket && this._socket.readable) {
this._curReq = this._queue.shift();
if (this._curReq.cmd === 'ABOR' && this._pasvSocket)
this._pasvSocket.aborting = true;
this._debug && this._debug('[connection] > ' + inspect(this._curReq.cmd));
let cmddata = this._curReq.cmd;
if (Buffer.isBuffer(cmddata)) cmddata = Buffer.concat([cmddata, Buffer.from('\r\n')]);
else cmddata += '\r\n';
this._socket.write(cmddata);
} else if (!this._curReq && !queueLen && this._ending)
this._reset();
}; |
how to resolve it? |
I resolve it , You need convert 'cmd' to 'GBK'.
|
hi, I'm using node-ftp at win7 cmd (chinese, gbk), and got trouble at list file name.
here is a workaround only for test, could you plz add support to this issue?
The text was updated successfully, but these errors were encountered: