Sails.js / Nodejs / Json 支持表情符号

Ivá*_*hez 0 api rest json node.js sails.js

有没有办法在 Sails REST api 上使用表情符号?我的表带有 utf8mb4_unicode_ci,手动我可以正确存储表情符号。但是在 web 视图和 api 响应上,它显示为一个问号“?”。

请。欢迎您提供任何提示。

谢谢

更多信息:

例如,我用这个点击了 api

{
    "name": "hello",
    "body": "Testing on node  v6.9  x4",
    "label": "info",
    "user": 1
}
Run Code Online (Sandbox Code Playgroud)

但回应是:

{
  "name": "hello",
  "body": "Testing on node  v6.9 ???? x4",
  "label": "info",
  "thanks": 0,
  "notUseful": 0,
  "createdAt": "2016-12-28T15:30:26.000Z",
  "updatedAt": "2016-12-28T15:30:26.000Z",
  "id": 105,
  "user": 1,
  "topic": null
}
Run Code Online (Sandbox Code Playgroud)

Vik*_*tor 5

您是否在或中将charsetcollation设置添加到您的 MySQL 配置中?config/connections.jsconfig/local.js

someMysqlServer: {
  adapter: 'sails-mysql',
  // other settings...
  charset: 'utf8mb4',
  collation: 'utf8mb4_unicode_ci',
}
Run Code Online (Sandbox Code Playgroud)