How do I very simply show a Euro symbol in Google Assistant? Every time that I attempt to I get the symbol in a different encoding. What simple thing am I missing?
actions-on-google SDK version 2.0.1
const { dialogflow } = require('actions-on-google')
const app = dialogflow({ debug: true })
app.intent('euro-intent', (conv) => {
console.log('€')
conv.ask('€')
})
exports.myBot = app
My action is calling a webhook on AWS API Gateway that is connected to a Lambda function using Node.js v 8.10. The CloudWatch logs show
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "€"
}
}
]
},
"userStorage": "{\"data\":{}}"
}
},
"outputContexts": [
{
"name": "projects/newagent-9bde7/agent/sessions/1525808242247/contexts/_actions_on_google",
"lifespanCount": 99,
"parameters": {
"data": "{}"
}
}
]
}
However, I get the below in the simulator.
In your webhook, use unicode for EURO SIGN. The unicode for EURO SIGN is U+20AC
In your Node.js implementation, use '\u20ac' notation.
In a string value, '\u' notation indicates that value is a unicode character denoted by four hex digits.
Here is the version with unicode value:
const { dialogflow } = require('actions-on-google')
const app = dialogflow({ debug: true })
app.intent('euro-intent', (conv) => {
console.log('\u20ac')
conv.ask('\u20ac')
})
exports.myBot = app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With