为什么一个信号不支持某些特殊字符? [英] Why some special characters are not supported in one signal?
问题描述
我正在使用onesignal从我的Web服务向移动应用发送推送通知.但是我意识到不支持某些字符,我们该怎么做才能解决此问题?下面是我的postString发送到onesignal:
I am using onesignal to send push notifications to mobile app from my webservice. but I realized that some characters are not supported, what can we do to resolve this issue? below is my postString sent to onesignal:
postString = "{""app_id"":""myID"",""language"":""ar"", ""tags"" :
[{""key"": ""my_key"", ""relation"": ""="", ""value"": """ & my_value& """}] ,
""data"" : {""contactName"" : """ & contactName & """ },
""contents"" : {""en"" : """ & pushMessage & """ } }"
当我尝试发送像+-*/.!@#$%^&*()_+=-?><|":;'\
这样的数据时,出现此错误:
远程服务器返回错误:(400)错误的请求.
注意:当我将语言更改为en时,我遇到了同样的错误.有什么主意吗?
when I tried to send data like +-*/.!@#$%^&*()_+=-?><|":;'\
I got this error:
The remote server returned an error: (400) Bad Request.
NB: When I changed language to en I got the same error. Any idea?
推荐答案
所有unicode字符均受支持.您的数据中的多余引号很可能导致了此问题.请转义任何单引号或双引号,以确保您的postString使用有效的JSON,这应该可以解决此问题.
All unicode characters are supported. It's possible that the extra quote in your data caused this issue. Please make sure that your postString is in a valid JSON by escaping any single or double quotes and that should resolve this issue.
这篇关于为什么一个信号不支持某些特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!