我想将Dialogflow中包含字母“ ööö”的字段“问题”的内容保存到Firebase实时数据库中。在Dialogflows“内联编辑器”中,我编写了以下代码:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.applicationDefault(),
databaseURL: 'ws://xxx-xxx.firebaseio.com/',
});
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function faq_de(agent) {
const question = agent.parameters.question;
agent.add("Feedback?");
return admin.database().ref('/').push({Question: question});
}
...
...
在Firebase实时日期库中,它向我显示了保存的值:
问题:“ ���”
有人知道吗,如何/在何处更改某些内容以在数据库中获取正确的格式“ utf-8”值?