如何发送带有ä,ö,ü等特殊字符的Firebase Cloud Messaging Notification? [英] How to send a Firebase Cloud Messaging Notification with special characters like ä, ö, ü?
本文介绍了如何发送带有ä,ö,ü等特殊字符的Firebase Cloud Messaging Notification?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图发送带有以下特殊字符的FCM通知:
I tried for a while to send a FCM Notification with special characters like this:
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
有人可以引导我朝正确的方向前进吗? 非常感谢!
Can anybody please guide me to the right direction? Thanks a lot!
编辑
客户端是浏览器,因为该应用是网络应用.
The client is a browser, because the app is a web-App.
推荐答案
根据@LangHoang,我尝试使用Base64编码和解码来获得特殊字符支持!
According to @LangHoang I tried to use Base64 encode and decode to get a special character support!
<?php
base64_encode ($string);
并使用javascript(firebase-messaging-sw.js)解码响应
and decode the response in javascript (firebase-messaging-sw.js)
body:b64DecodeUnicode(payload.notification.body)
现在一切都很好!
这篇关于如何发送带有ä,ö,ü等特殊字符的Firebase Cloud Messaging Notification?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文