未知值<缓冲器d2 f3 f0 e0 e5 e2 e0 20>当从Node.js中的firebird中选择时 [英] unknown value <Buffer d2 f3 f0 e0 e5 e2 e0 20> when select from firebird in Node.js

查看:107
本文介绍了未知值<缓冲器d2 f3 f0 e0 e5 e2 e0 20>当从Node.js中的firebird中选择时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是firebird的新朋友。我试图从DB获取名称,但它返回:

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();
});


推荐答案

它是一个Buffer对象(NodeJS docu),这是数据的通常返回值,其类型不是预定的。

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

要再次将其转换为字符串,请使用其 toString() 方法与给定的编码,例如:

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

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

这篇关于未知值&lt;缓冲器d2 f3 f0 e0 e5 e2 e0 20&gt;当从Node.js中的firebird中选择时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆