lars1595
lars1595

Reputation: 925

IIB Mq Output "Error converting character string" when Croatian š in Json body

If MQ output get a Json message with a Croatian š it will fail with error message "Error converting character string". I tried setting codepage to 1208 don't seem to help. The Croatian š is part of UTF-8

Compute node only set the property with out to MQ output

CREATE COMPUTE MODULE getTest_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN 
      SET OutputRoot.JSON.Data .name                    =     ' š ' ;   

    RETURN TRUE;
    END;

 END MODULE;

Image of flow:

enter image description here

Full Errro message:

                      Text:CHARACTER:JSON writing errors have occurred
                      RecoverableException
                              File:CHARACTER:C:\ci\product-build\WMB\src\CommonServices\ImbConverter.cpp
                              Line:INTEGER:882
                              Function:CHARACTER:ImbConverterCPP::fromUnicode
                              Type:CHARACTER:
                              Name:CHARACTER:
                              Label:CHARACTER:
                              Catalog:CHARACTER:BIPmsgs
                              Severity:INTEGER:3
                              Number:INTEGER:2130
                              Text:CHARACTER:Error converting character string
                              Insert
                                      Type:INTEGER:2
                                      Text:CHARACTER:850
                              Insert
                                      Type:INTEGER:2
                                      Text:CHARACTER:10

Upvotes: 0

Views: 305

Answers (1)

kimbert
kimbert

Reputation: 2422

You are using IBM code page 850 as the output character set. This does not support the character that you are trying to output.

You need to set the output character set to a Unicode encoding - UTF-8 is the normal choice. This should do the job:

SET OutputRoot.Properties.CodedCharSetId = 1208;

The above code has not been tested, but hopefully you get the idea anyway.

Upvotes: 3

Related Questions