grpc-node icon indicating copy to clipboard operation
grpc-node copied to clipboard

error details of the chinese will be will be truncated, a chinese charactor is three bytes

Open bysir-zl opened this issue 8 years ago • 1 comments

Problem description

error details of the chinese will be will be truncated

Reproduction steps

in service.js

function sayHello(call, callback) {
    callback({
        code: grpc.status.NOT_FOUND,
        details: '你好啊世界'
    });
}

client.js

  client.sayHello({name: user}, function (err, response) {
    if (err) {
      console.log(err.details);
    } else {
      console.log('Greeting:', response.message);
    }
  });

this client.js will print :

$ node greeter_client.js
(node:15552) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module wi
th grpc.loadPackageDefinition instead
你�

Environment

Additional context

a chinese charactor is three bytes

bysir-zl avatar Jul 09 '18 13:07 bysir-zl

Full reproduction case attached. This one's interesting.

string-issue.zip

nicolasnoble avatar Jul 09 '18 16:07 nicolasnoble