2016-12-27 117 views
0

有没有一种方法可以在Sails REST API上使用emojis?我有我的表与utf8mb4_unicode_ci和手动我可以正确地存储emojis。但在Web视图和API响应上,它显示为一个问号“?”。Sails.js/Nodejs/Json支持emojis

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

谢谢

更多信息:

比如我打的API与此

{ 
    "name": "hello", 
    "body": "Testing on node v6.9 x4", 
    "label": "info", 
    "user": 1 
} 

但响应:

{ 
    "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 
} 
+0

您可以向我们展示API响应,以及如何获取它? –

+0

做到了。请问,你有什么想法。或者你是否知道在休息API中使用表情符号的正确方法? –

+0

对不起,我试图改变“做”为“完成”,但我得到这个错误http://meta.stackoverflow.com/questions/339725/users-without-the-comment-privilege-unable-to -edit-their-own-comments –

回答

3

你有没有加入charsetcollation设置到您的MySQL配置config/connections.jsconfig/local.js

someMysqlServer: { 
    adapter: 'sails-mysql', 
    // other settings... 
    charset: 'utf8mb4', 
    collation: 'utf8mb4_unicode_ci', 
} 
+0

我爱你。真的真的非常感谢你.. –

+0

这工作完美。 –