nodejs + node-tds を使用して、SqlServer 2008r2 Express データベースに接続しています。uniqueidentifier を持つオブジェクトを取得し、オブジェクト全体を json として返しています。
行を正常に取得できますが、json への応答をシリアル化しようとすると、ファンキーになります。
{
"Id": "�<�E�ԃM��\u0000ؚ��J",
"RealName": "Zachary Yates"
}
私が使用しているコードは次のとおりです。
var q = conn.createStatement("select u.Id, u.RealName from [User] u where u.Id = @id;",
{
id: { type: "uniqueidentifier" }
});
q.on("row", function(row)
{
var user =
{
Id: row.getValue("Id").toString()
, RealName: row.getValue("RealName")
};
res.json(user);
});
q.execute({id: uid});