开发者

Push Notification in non english languages

开发者 https://www.devze.com 2022-12-17 21:47 出处:网络
I have implemented successfully this code: Does anyone know how to write an Apple Push Notification Provider in C#?

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 no开发者_C百科n english messages like Hebrew Or Arabic?

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

Thank you


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) 
0

精彩评论

暂无评论...
验证码 换一张
取 消