Closed eaba closed 8 years ago
No, I no longer work in C#.
Can you help me? I am experiencing an issue where the first part of concatenated messages is 173 causing the message to be rejected. How can i fix this?
Not knowing anything, check you are using the proper encoding. If I recall there are several character sets you are use. ASCII7 and Latin
I am using the default encoding(that is 0 and 1). Are you recommending ASCII7 and LATIN?
Can you kindly explain this: maxBytes = Convert.ToInt32(Math.Floor(Convert.ToDouble(maxBytes) * 8 / 7));
?
I believe thats where the issue is with a 160-6 maxBytes one gets 176!
I replaced SplitMessageOnParts with:
public static List<String> Split(string message, int maxPartLength)
{
var result = new List<String>();
for (var i = 0; i < message.Length; i += maxPartLength)
{
var chunkSize = i + maxPartLength < message.Length ? maxPartLength : message.Length - i;
var chunk = new char[chunkSize];
message.CopyTo(i, chunk, 0, chunkSize);
result.Add(new string(chunk));
}
return result;
}
And this worked for me!!
@eaba how have you done the replacement?
SplitMessageOnParts declaration is List<byte[]> SplitMessageOnParts(byte[] messageBytes, int maxLength)
while your split method is List<String> Split(string message, int maxPartLength)
Please assist me
I'm excited you got things working. You will need to fork the project since I can't validate the changes. I'm not working on this code base anymore. I wish I had tests but I don't. That is the real problem here. Since I never experienced this problem I am not sure what is different.
@ardan-bkennedy I have sent a pull request! @emakumba check my fork of it!
Do you still maintain this project?