arashnorouzi/Moon-APNS — Issue #5: Encoding problem
Author: joco73
Created: 2012-01-28 10:33:07+00:00
State: open

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