For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

Convert RefreshMsg(C++) to rsslRefreshMsg for encode then decode back

Hi I want to save RefreshMsg to file and later replay it, for chinese charactor, decode back with garbled charactor, can some one help figure out?1716864134490.jpeg

Here is the code:

cn_demo.txt

#technologyema-api#productc++refinitiv-realtime-optimised
1716864134490.jpeg (211.4 KiB)
cn-demo.txt (5.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
81.2k 266 53 76

@jessie.deng

Thank you for reaching out to us.

The problem is the code directly encodes and decodes UTF8 as RMTES.

To encode UTF8 to RMTES, a UTF8 string must be prepended with the following three bytes escape sequence: 0x1B, 0x25, and 0x30, as mentioned in the Encoding and Decoding non-ASCII text using EMA and RFA C++/.NET article.

The sample code looks like this:

    rsslFEntry.fieldId = 1352;
    rsslFEntry.dataType = RSSL_DT_RMTES_STRING;    


    const char utf8_prefix[] = { 0x1B,0x25,0x30, 0 };
    const char* value = "24附息國債07";
    
    char* rmtes_value = (char*)malloc(strlen(utf8_prefix) + strlen(value));
    strcpy(rmtes_value, utf8_prefix);
    strcat(rmtes_value, value);
    RsslBuffer vbuf = { 0 };
    vbuf.data = rmtes_value;
    vbuf.length = strlen(rmtes_value);
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks @Jirapongse , that's helpful!

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.