推送非英语语言通知 [英] Push Notification in non english languages

查看:200
本文介绍了推送非英语语言通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功实施此代码:

有谁知道如何在C#中编写Apple推送通知提供程序?

效果很好。但我有一个问题,有人可以帮我发送希伯来语或阿拉伯语等非英语信息吗?

It works great. But I have a question, can anybody help me how to send non english messages like Hebrew Or Arabic?

如果字符串包含任何非英语字符,则不会发送。

If the string contains any non english characters, it is not sent.

谢谢

推荐答案

我找到了解决方案。

长度错了。在代码中,我们在计数之前传递字符串的长度。我们应该在UTF编码后计算:

The length was wrong. In the code we pass the length of the string before the counting. We should count it after the UTF encoding:

writer.Write((byte)0); //First byte of payload length; (big-endian first byte) 
enter code herebyte[] b1 = System.Text.Encoding.UTF8.GetBytes(payload);
writer.Write((byte)b1.Length);     //payload length (big-endian second byte) 

这篇关于推送非英语语言通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆