ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

YAJL problem with russian characters.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • YAJL problem with russian characters.

    Hello:

    I have been using YAJL for many time with good results.

    The problem is that we have now a new project for Russia, and we must send and seceive cyrillic characters.

    For example, we have to send a JSON document like this:

    {
    .....
    "Items": [
    {
    "Label": "Это тест",
    "Price": 1.00,
    "Quantity": 1,
    "Amount": 1.00,
    "Vat": "Vat10"
    }
    ]
    .....
    }

    In the "Label" we have to send a russian text.

    We have the data in russian in a PF FILE like this:

    ...
    A LABEL 65G COLHDG('Label')
    A CCSID(1200 *NOCONVERT)
    ...


    And we are using YAJL, this way:

    // ..............
    yajl_beginArray('Items');

    setll tc_codigo rtetickd;
    dou %eof(TE_TICK_D);
    reade tc_codigo rtetickd;
    if not %eof;
    yajl_beginobj();

    yajl_addchar('Label':%char(tcd_label)); // !!!!!
    yajl_addnum('Price':%char(tcd_price));
    yajl_addnum('Quantity':%char(tcd_quantity));
    yajl_addnum('Amount':%char(tcd_amount));
    yajl_addchar('Vat':%trim(tcd_vat));

    yajl_endobj();
    endif;
    enddo;

    // .................

    What am I doing wrong? I have tried with yajl_addcharptr also, with the same results. The only way it works is with yajl_addcharstmf.

    Thanks in advance.


    Christian Larsen









  • #2
    Is your job running under a CCSID that supports Cyrillic characters? Remember, the input to yajl_addChar is an EBCDIC field, and you are converting your UTF-16 database field to EBCDIC in the program. (You are coding %CHAR for this, though newer RPG will do it even wtihout the %CHAR). Is your job CCSID able to support Cyrillic in EBCDIC? If not, that is the problem.

    Comment

    Working...
    X