012 is the octal value for a line feed, could be the reason the transfer seems to be splitting.
Prior to sending and receiving the data, trim it. Make sure your buffer is large enough to hold the largest data expected.
string Trim (string str)
{
int notwhite = str.find_last_not_of(" \t\n");
str.erase(notwhite+1);
return str;
}