Page 1 of 1

QCMDEXC and unicode

Posted: Mon Mar 03, 2014 11:03 pm
by Paul
We have a number of PHP scripts called from RPGLE using QCMDEXC, passing parameters that PHP reads through the $_SERVER array. We use this when something is difficult to do in RPG, (e.g. json_decode). All works great, but now we have a requirement to pass unicode characters as parameters (e.g. Chinese). QCMDEXC is not happy about this, I suppose as its command string is defined as type "a".

Does anyone know a way of calling a PHP script from RPGLE passing a non-EBCDIC parameter? A work-around could be to send the parameters as an IFS file and then open and read this in the PHP. This would add extra overhead and would be messy as the files would need to be created/destroyed etc. If anyone knows a more graceful method it would be much appreciated.

Paul

Re: QCMDEXC and unicode

Posted: Tue Mar 04, 2014 10:19 am
by Scott Klement
Maybe you create a hex dump of the parameter data, pass that to the PHP script, and have the PHP script convert them back to Unicode? It would require some extra programming, obviously... but should allow all data to be passed.

I haven't tried it, myself, but it seems like it should work.

Re: QCMDEXC and unicode

Posted: Sun Mar 09, 2014 10:59 pm
by Paul
Thanks Scott, good idea, I think that would work. We had already started the temp file solution with the parameters being json pairs in the temp file, and it's working well. I'll give the hex conversion a go though.

Thanks,

Paul