将包含特殊字符的标签发送到Azure通知中心 [英] Sending tags containing special characters to Azure Notification Hub
问题描述
我们想在iPad应用程序中使用Azure通知中心,但是遇到了问题.决定谁获得推送消息的标签是一个电子邮件地址,如果它仅包含普通字符,则可以正常工作.但是,当我们尝试发送如下所示的标签时,它不起作用:
We want to use Azure Notification Hubs in our iPad app but we have run into a problem. The tags that determine who gets the push message is an email address and it works fine if it only contains normal characters. But it does not work when we try to send a tag looking like this:
test+10@gmail.com
test+10@gmail.com
或
test%10@gmail.com
test%10@gmail.com
我们正在使用此方法从后端发送推送:
We are using this method to send push from the backend:
http://msdn.microsoft.com/en-us/library/windowsazure/dn539552.aspx
这样做时,我们会收到以下消息:
When we do so we get this message:
无效标记test+10@gmail.com.TrackingId:48b6f399-3f27-40b4-a6f9-b0838623c9c3_G19,TimeStamp:2013/12/10 12:38:38 PM
Invalid tag test+10@gmail.com.TrackingId:48b6f399-3f27-40b4-a6f9-b0838623c9c3_G19,TimeStamp:12/10/2013 12:38:38 PM
无效请求(400)
我们仔细阅读了文档,以了解它是否表明我们需要以特殊方式对标签进行编码,但没有发现任何问题.
We have looked through the documentation to see if it states somewhere that we need to encode tags in a special way but have found nothing.
我们无法想象这是不可能的,因为这一定是常见的情况.希望有人能帮忙.
We cannot imagine that this is not possible since it must be a common scenario. Hope someone can help.
欢呼
推荐答案
标记中允许使用的字符为:ASCII-7字母数字字符加 {'.','-','_','〜',':','@','#'}
.长度上限为120个字符.
The allowed characters in tags are: ASCII-7 alphanumeric characters plus {‘.’, ’-’, ’_’, ’~’, ‘:’, ‘@’, ‘#’}
. Max length is 120 chars.
您可以通过将任意字符串编码为二进制然后是十六进制来对任意字符串进行编码.
You can encode arbitrary strings by encoding it in binary and then hex.
这篇关于将包含特殊字符的标签发送到Azure通知中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!