我试了一会儿发送带有以下特殊字符的FCM通知:
curl --header "Authorization: key=Auth-CODE"
--header Content-Type:"application/json
for JSON; application/x-www-form-urlencoded;charset=UTF-8"
-d '{"to":"token","notification":{"title":"München",
"body":"Test Content with äöü",
"icon":"images/icon-192x192.png"}}'
https://fcm.googleapis.com/fcm/send
我将收到的通知如下所示:
Mnchen
Test Content with
有人可以指导我朝正确的方向吗?非常感谢!
编辑
客户端是浏览器,因为该应用程序是网络应用程序。
根据@LangHoang的说法,我尝试使用Base64编码和解码来获得特殊字符支持!
<?php
base64_encode ($string);
并在javascript(firebase-messaging-sw.js)中解码响应
body:b64DecodeUnicode(payload.notification.body)
现在一切都很好!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句