Mfast decoder.decode Failed

257 views Asked by At

when i am calling

message_cref msg = decoder.decode(start,end);

it is throwing

\src\mfast\coder\decoder\fast_istreambuf.h(47): Throw in f
unction unsigned char __thiscall mfast::fast_istreambuf::sbumpc(void)
Dynamic exception type: class boost::exception_detail::clone_impl<class mfast::fast_dynamic_error>
std::exception::what: Unknown exception [struct mfast::tag_error_code *] = Buffer underflow

it is a library header file. This doesn't arises when i hard code a string and pass it to decode but fails when I pass data by encoding it to UTF-8.

the Data Which i get from exchange is

"Ýÿ”20181009-06:49:09.66±±jÏ€€€‚_À€ôCOCUDAKL20DEC201¸2972³ø2?IÁ€€€€€€€s•€€€€€€€€€€“ö€‚ "

Converting it to UTF-8 using C++/CLI

array<Byte>^ byteArray = Encoding::UTF8->GetBytes(toBeEncoded);

    for each(Byte v in byteArray)
    {
          finalString += String::Format("0x{0:X2},", v);
    }
       string mani = context.marshal_as<string>(finalString);
        mani.pop_back(); //To eliminate last ',' from String.
        cout << "Manipulated String \n" << mani << endl;

        int length = mani.length();
        strcpy_s(fast_message,3000,mani.c_str());

Here my motive is to get data in this Format:char  fast_message[] = { 0xC3, 0x9D, 0xC3, 0xBF, 0xE2, 0x80, 0x9D, 0x32, 0x30, 0x31, 0x38, 0x31, 0x30, 0x30, 0x39, 0x2D, 0x30, 0x36, 0x3A, 0x34, 0x39, 0x3A, 0x30, 0x39, 0x2E, 0x36, 0x36, 0xC2, 0xB1, 0xC2, 0xB1, 0x1F, 0x6A, 0xC3, 0x8F, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x80, 0x9A, 0x5F, 0x7F, 0x7F, 0xC3, 0x80, 0xE2, 0x82, 0xAC, 0xC3, 0xB4, 0x43, 0x4F, 0x43, 0x55, 0x44, 0x41, 0x4B, 0x4C, 0x32, 0x30, 0x44, 0x45, 0x43, 0x32, 0x30, 0x31, 0xC2, 0xB8, 0x32, 0x39, 0x37, 0x32, 0xC2, 0xB3, 0xC3, 0xB8, 0x05, 0x08, 0x32, 0x3F, 0x49, 0xC3, 0x81, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0x73, 0xE2, 0x80, 0xA2, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC, 0xE2, 0x80, 0x9C, 0xC3, 0xB6, 0xE2, 0x82, 0xAC, 0xE2, 0x80, 0x9A, 0x03, 0xC3, 0xA2, 0xE2, 0x82, 0xAC, 0xE2, 0x82, 0xAC };

Where as if i hard code fast_message in declaration it works but not when i do different operations or while Debugging i get the Value same as hard-coding it.

Any Suggestions why it is going Underflow.

0

There are 0 answers