Push Notification in non english languages

南笙酒味 提交于 2019-11-30 19:49:11

问题


I have implemented successfully this code:

Does anyone know how to write an Apple Push Notification Provider in C#?

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.

Thank you


回答1:


I found the solution.

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) 


来源:https://stackoverflow.com/questions/2111076/push-notification-in-non-english-languages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!