User Answers

The %SYSTEM.SQL::Execute() method returns an %SQL.StatementResult object. I'm not that familiar with the iris.node module, but it appears that invoke_classmethod() does not return an object that you can pass to invoke_method() or get_property(). However, it seems that you can fake it by copying the "result" field into a new object as "oref":

The main thing I can suggest is to verify that the client and server agree on the encoding. It's been years since I've used Reflection; hopefully it supports UTF-8. Check your settings and/or documentation.

When you're in a Caché session, look at the value of the $zmode special variable:

USER>w $zm
RY\Latin1\K\UTF8\

I'm not sure offhand what determines the default I/O translation table for a terminal, but if you see "RAW" instead of "UTF8", you can set it manually:

$toJSON() escaped forward slash unnecessarily in 2016.1. It's valid JSON, but unconventional. %ToJSON() doesn't do this in 2016.2 and later. Depending on your data, you may be able to get away with $replace(json,"\/","/"). To handle all cases would be a bit more work.

The first $zf(-100) call doesn't work, because you're trying to redirect with the /STDOUT flag and the ">>" operator. You can do one or the other, but not both.

If you add the /LOGCMD flag to the second $zf(-100) call, you should see something like the following in messages.log:

    $ZF(-100) cmd=type "" file1.txt

I suggest that you not put an empty string in your options array.

I'm not that familiar with adapters, but the documentation suggests that you need to use the SkipBodyAttrs property to send a header like Content-Type. Also, I think you need to decide whether you're sending form data or a body. When tFormVar is "Content-Type,apikey", the documentation says that your third data argument will be assigned to the last form variable, apikey, which is almost certainly not what you want. Your second try with three variables looks more likely to work, depending on what the service expects in the body.

I don't think that your test method is being run. I'm pretty sure that it has to start with "Test" (with a capital "T") for the manager to discover it.

You've set the TranslateTable for both stream and tNewStream to "cp1252". If the input file is UTF-8, then stream.TranslateTable should be "UTF8". Otherwise, each UTF-8 code unit (i.e., byte) is read in separately as a CP1252 character.