unknown value <Buffer d2 f3 f0 e0 e5 e2 e0 20> when select from firebird in Node.js

拈花ヽ惹草 提交于 2019-12-11 03:35:11

问题


I'm new at firebird. I am trying to fetch the name from DB, but it returns:

<Buffer d2 f3 f0 e0 e5 e2 e0 20>

What does it mean? How to convert it to readable characters? Thanks in advance

db.query('SELECT FIRST 10 * FROM client', function(err, result) {
    // IMPORTANT: close the connection 
    console.log(result[0].name)
    db.detach();
});

回答1:


It is a Buffer object (NodeJS docu), which is the usual return value for data, whose type is not predetermined.

To convert it to a string again, use its toString() method with a given encoding, e.g.:

var name = result[0].name.toString( 'utf8' );


来源:https://stackoverflow.com/questions/29672531/unknown-value-buffer-d2-f3-f0-e0-e5-e2-e0-20-when-select-from-firebird-in-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!