silkjs/tedis

Wrong length in Protocol.encode

spacemeowx2 opened this issue · 1 comments

If you are storing multibyte character like Chinese, the redis server will return error: UnhandledPromiseRejectionWarning: ERR Protocol error: unbalanced quotes in request

https://github.com/myour-cc/tedis/blob/8a082969382b15ced4a75299c23feaa3a18c8643/src/core/protocol.ts#L122

https://github.com/myour-cc/tedis/blob/8a082969382b15ced4a75299c23feaa3a18c8643/src/core/protocol.ts#L125

I suggest replace parameter.length with Buffer.byteLength(parameter).

thanks for your advice, I'm going to rewrite the protocol with Buffer