Open Martin-Zeithaml opened 9 months ago
This isn't what I thought at first. changeTag DOES work - sometimes. if you do 1047 instead of 0, it works. It looks like basically any number except 0 works. There's some edge case around 0 (remove tag) When it works it does not print garbage.
i think the cause is here https://github.com/JoeNemo/quickjs-portable/blob/main/porting/polyfill.c#L142 the conditional says text or binary. 0 is neither.
I have noticed this difference, when used zos.zstat
for
"isText":true,"ccsid":819
"isText":false,"ccsid":0
This seems to help:
#define CCSID_NONE 0
...
if (ccsid == CCSID_NONE || ccsid == CCSID_BINARY ) {
attr.att_filetag.ft_txtflag = 0;
} else {
attr.att_filetag.ft_txtflag = 1;
}
However the printf
problem remains.
printf
of EBCDIC hex code is working:
printf("\xC8\x85\x93\x93\x96\x6B\x40\xA6\x96\x99\x93\x84\x5A"); -> Hello, world!
I am guessing, this is some #define
, compiler option or something missing.
toEBCDIC
or printf2
should help.
Garbage on the screen remains.
Most likely caused by not using printf2
.
This can be reproduced when __chattr
will fail, e.g. zos.changeTag('file which does not exist', 0);
Merged, working fine.
How to replicate
Simple
testcht.js
:File
a.txt
exists,t ISO8859-1 T=on a.txt
.Running the script:
The garbage on the screen is printed here.
Problem 1
printf
is for some reason producing garbage.Example
When the error message was changed:
printf("abcd0123")
will produceX'2FC2C4C0 90911693'
Is this encoding problem?Problem 2
It does not work, the
js
code should remove the tag, which remains unchanged.