arashnorouzi / Moon-APNS

A free open source c# library for sending Apple Push Notifications in any .net application.
http://arashnorouzi.wordpress.com
90 stars 45 forks source link

Encoding problem #5

Open joco73 opened 12 years ago

joco73 commented 12 years ago

Hi,

Great package.

When we have languages that use f.ex. åäö we can't have ascii encoding, we then need UTF8, on your blog a comment has a solution that works for us (see below), but would be great to have this in the package - as a config. parameter or something else.

On line 296 in ‘PushNotification.cs’ file, I have modified your code as follows..

// String length byte[] apnMessageLength = BitConverter.GetBytes((Int16)Encoding.UTF8.GetBytes(apnMessage).Length);

and on line 305 was modified as

// Write the message memoryStream.Write(Encoding.UTF8.GetBytes(apnMessage), 0, Encoding.UTF8.GetBytes(apnMessage).Length);

/Jonathan

soundtina commented 11 years ago

@joco73 yeah it's helpful. Now i can send Chinese to my phone. That's cool.