From ddd120bb75a29c78ec118e573ae68ea0ece0618c Mon Sep 17 00:00:00 2001 From: munja Date: Thu, 14 Apr 2022 19:31:36 +0100 Subject: [PATCH] fix: avoid sending BOM marker to SASjs API --- all.sas | 12 ++++++++++-- base/mp_init.sas | 2 +- server/ms_createfile.sas | 9 ++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/all.sas b/all.sas index 6b05f3d..34989a3 100644 --- a/all.sas +++ b/all.sas @@ -8239,7 +8239,8 @@ options %end; ; -%mend mp_init;/** +%mend mp_init; +/** @file mp_jsonout.sas @brief Writes JSON in SASjs format to a fileref @details PROC JSON is faster but will produce errs like the ones below if @@ -18937,12 +18938,16 @@ run; ,mdebug=0 ); -%local fname0 fname1 fname2 boundary fname statcd msg; +%local fname0 fname1 fname2 boundary fname statcd msg optval; %let fname0=%mf_getuniquefileref(); %let fname1=%mf_getuniquefileref(); %let fname2=%mf_getuniquefileref(); %let boundary=%mf_getuniquename(); +/* avoid sending bom marker to API */ +%let optval=%sysfunc(getoption(bomfile)); +options nobomfile; + data _null_; file &fname0 termstr=crlf; infile &inref end=eof; @@ -19003,6 +19008,9 @@ run; ,msg=%superq(msg) ) +/* reset options */ +options &optval; + %mend ms_createfile; /** @file diff --git a/base/mp_init.sas b/base/mp_init.sas index e94a27d..bed1803 100644 --- a/base/mp_init.sas +++ b/base/mp_init.sas @@ -73,4 +73,4 @@ options %end; ; -%mend mp_init; \ No newline at end of file +%mend mp_init; diff --git a/server/ms_createfile.sas b/server/ms_createfile.sas index e12bfe3..02fa57b 100644 --- a/server/ms_createfile.sas +++ b/server/ms_createfile.sas @@ -29,12 +29,16 @@ ,mdebug=0 ); -%local fname0 fname1 fname2 boundary fname statcd msg; +%local fname0 fname1 fname2 boundary fname statcd msg optval; %let fname0=%mf_getuniquefileref(); %let fname1=%mf_getuniquefileref(); %let fname2=%mf_getuniquefileref(); %let boundary=%mf_getuniquename(); +/* avoid sending bom marker to API */ +%let optval=%sysfunc(getoption(bomfile)); +options nobomfile; + data _null_; file &fname0 termstr=crlf; infile &inref end=eof; @@ -95,4 +99,7 @@ run; ,msg=%superq(msg) ) +/* reset options */ +options &optval; + %mend ms_createfile;