We are trying to contribute norwegian characters to pages using RFA.NET version 8.

The string gets converted to some strange ascii codes in the buffer and the result is that we get an error stating the text is too big.

How can we achieve sending norwegian characters through the API. This works fine from Excel.

Tagged:

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    Most fields in RDMFieldDictionary use RMTES (Reuters Multilingual Text Encoding Standard).

    DSPLY_NAME "DISPLAY NAME" 3
    NULL ALPHANUMERIC 16
    RMTES_STRING 16

    ROW64_1 "MONROW
    1" 215 NULL
    ALPHANUMERIC 64 RMTES_STRING 64

    ROW64_2 "MONROW
    2" 216 NULL
    ALPHANUMERIC 64 RMTES_STRING 64

    ROW64_3 "MONROW
    3" 217 NULL
    ALPHANUMERIC 64 RMTES_STRING 64

    ROW64_4
    "MONROW 4"
    218 NULL ALPHANUMERIC 64
    RMTES_STRING 64

    To encode Norwegian characters (æ, â, å) in RMTES fields, you need to follow
    this standard.

    image

    For example:

    image

    To convert RMTES to UTF8 or UCS2, you need to use
    RMTESConverter class in RFA.NET package. For more information, please refer to Section
    5.2.5 RMTESConverter
    in the RFA.NET Developers Guide.

Answers

  • For Norwegian characters, the RMTES encoding is the same as Unicode encoding, which means you can use .NET UnicodeEncoding .

    byte[] byte_to_send = UnicodeEncoding.Unicode.GetBytes("Riksmål åæâéèêøóòô");
    byte_to_send = byte_to_send.Where(b => b != '\0').ToArray(); // Linq: remove '\0' character from byte array
    RFA_String rfaString = new RFA_String(byte_to_send);
    dataBuffer.SetFromString( rfaString, ThomsonReuters.RFA.Data.DataBuffer.DataBufferEnum.StringRMTES );
    field.Data = dataBuffer;