IBM / nodejs-idb-connector

A JavaScript (Node.js) library for communicating with Db2 for IBM i, with support for queries, procedures, and much more. Uses traditional callback-style syntax
MIT License
37 stars 23 forks source link

charset - german secial chars #70

Closed jogisarge closed 4 years ago

jogisarge commented 5 years ago

i run a testscript that sends an ‘wrksyssts’ via idb-connector to our ibm i. the js-script has the ccsid 819. if i run the script, the special chars are broken.

Größe -> Größe

const idb = require('idb-connector'),
  {dbconn, dbstmt, IN, OUT, CHAR, CLOB} = idb;
const sql = "CALL QXMLSERV.iPLUG512K(?,?,?,?)";
const connection = new dbconn();
connection.conn("*LOCAL");
const statement = new dbstmt(connection);

const ipc = "*NA";
const ctl = "*here";
const xmlIn = "<xmlservice><sh>system 'wrksyssts'</sh></xmlservice>";
const xmlOut = "";

statement.prepare(sql, () => {
  statement.bindParam([
    [ipc, IN, CHAR],
    [ctl, IN, CHAR],
    [xmlIn, IN, CLOB],
    [xmlOut, OUT, CLOB]
  ], () => {
    statement.execute((out) => { // 'out' is an array of output params
      for(let i = 0; i < out.length; i++)
        console.log( out[i] );
      statement.close();
      connection.disconn();
      connection.close();
    });
  });
});

Has somebody an idea whats going wrong ?

dmabupt commented 5 years ago

@jogisarge I have no such an environment to recreate the issue. But would you refer to this? The $ctl="*before(819/37) *after(37/819)" example may help.

      * -- CCSID conversion XMLSERVICE (1.6.2)
      * *before(CCSIDFrom/CCSIDTo[/action])
      *    - conversion before calling XML processing 
      *      - CCSIDFrom - XML document client CCSID
      *      - CCSIDTo   - XML document XMLSERVICE CCSID
      *      - action
      *        call   - call XMLSERVICE (default)
      *        nocall - convert only (no call)
      * *after(CCSIDFrom/CCSIDTo)
      *    - conversion after calling XML processing
      *      - CCSIDFrom - XML document XMLSERVICE CCSID
      *      - CCSIDTo   - XML document client CCSID
      * *pase(CCSIDpase/CCSIDile)
      *    - conversion PGM, LIB, etc, names call processing
      *      - CCSIDpase - name CCSID PASE side (ascii)
      *      - CCSIDile  - name CCSID ILE side (ebcdic)
      *
      *    example: $ctl="*before(819/37) *after(37/819)";
      *      - DB2 interface provides many possibilities
      *        iPLUGxxx - original CLOB automatic DB2 converts
      *        iBLOBxxx - raw binary no DB2 converts (1.6.2)
      *      - action='nocall' is used to convert
      *        anything on IBM i and send it back
      *        without calling XMLSERVICE
      *      - DB2 interface conversion effects are
      *        virtually unlimited performed on IBM i
      *        avoiding additional "code tables" on client
      *      - *pase default (should work)
      *        ILE ccsid 0 means job CCSID (all ebcdic)
      *        PASE csid default Qp2paseCCSID (see API)
github-actions[bot] commented 4 years ago

:wave: Hi! This issue has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed.