<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PROC HTTP - how do I encode for ÆØÅ in SAS Community Nordic</title>
    <link>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522501#M216</link>
    <description>&lt;P&gt;You don't write what you are encoding from to. But my guess is that the file you are attempting to download is in uft-8 while SAS data is in wlatin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this is the case, the best option is to change the encoding from uft-8 to wlatin. You can do this using filename.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp "C:\Temp\utf8file.txt" encoding='utf-8';
filename resp1 "C:\Temp\wlatinfile.txt" encoding='wlatin1';

data _null_;
  infile resp;
  file resp1;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope it works&lt;/P&gt;</description>
    <pubDate>Wed, 19 Dec 2018 12:54:42 GMT</pubDate>
    <dc:creator>rudfaden</dc:creator>
    <dc:date>2018-12-19T12:54:42Z</dc:date>
    <item>
      <title>PROC HTTP - how do I encode for ÆØÅ</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522495#M215</link>
      <description>&lt;P&gt;This code work fine - except for encoding of special characters ÆØÅ (and others). How do I change the encoding to UTF-8?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*****&lt;/P&gt;
&lt;P&gt;filename req "F:\SASNykredit\CURL-HTTP\HTTP trial\Datafiler\request.txt" ;&lt;BR /&gt;filename resp "F:\SASNykredit\CURL-HTTP\HTTP trial\Datafiler\response.txt" MOD termstr=CRLF;&lt;BR /&gt;filename binfile "F:\SASNykredit\CURL-HTTP\HTTP trial\Datafiler\testdata2.xlsx";&lt;BR /&gt;filename head "F:\SASNykredit\CURL-HTTP\HTTP trial\Datafiler\Header.txt" recfm=V;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let _boundary=3fbd04f5-b1ed-4060-99b9-fca7ff59c113;&lt;BR /&gt;%let _cat=Fokuslisten;&lt;BR /&gt;%let _bankID=Pengeinstitut_Bank_1;&lt;BR /&gt;%let _publdate=%sysfunc(today(), yymmddd10.);&lt;BR /&gt;%let _expdate=%sysfunc(intnx(MONTH,%sysfunc(today(),8.),12,S),yymmddd10.);&lt;BR /&gt;%let _showndate=%sysfunc(intnx(DAY,%sysfunc(today(),8.),2,S),yymmddd10.);&lt;BR /&gt;%let _binname=%scan(%sysfunc(pathname(binfile)),-1,'\');&lt;BR /&gt;%let _title=%upcase(&amp;amp;sysuserid) TEST &lt;STRONG&gt;ÆØÅ&lt;/STRONG&gt; &amp;amp;_publdate.;&lt;BR /&gt;%let _apikey=xxx;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;=_boundary &amp;amp;=_cat &amp;amp;=_publdate &amp;amp;=_expdate &amp;amp;=_title &amp;amp;=_binname;&lt;BR /&gt;%put &amp;amp;=_bankID &amp;amp;=_showdate &amp;amp;=_apikey;&lt;/P&gt;
&lt;P&gt;/*** Fanger fejlkode fra PROC HTTP ***/&lt;BR /&gt;%macro prochttp_check_return(_exp_code);&lt;BR /&gt;%if %symexist(SYS_PROCHTTP_STATUS_CODE) ne 1 %then &lt;BR /&gt; %do;&lt;BR /&gt; %put ERROR: Expected &amp;amp;_exp_code., but a response was not received from the HTTP Procedure;&lt;BR /&gt; %end;&lt;BR /&gt;%else &lt;BR /&gt; %do;&lt;BR /&gt; %if &amp;amp;SYS_PROCHTTP_STATUS_CODE. ne &amp;amp;_exp_code. %then &lt;BR /&gt; %do;&lt;BR /&gt; %put ERROR: Expected &amp;amp;_exp_code., but received &amp;amp;SYS_PROCHTTP_STATUS_CODE.;&lt;BR /&gt; %put ERROR: &amp;amp;SYS_PROCHTTP_STATUS_PHRASE.;&lt;BR /&gt; %end;&lt;BR /&gt; %else&lt;BR /&gt; %do;&lt;BR /&gt; %put NOTE: Alt i orden, forventet returkode: &amp;amp;SYS_PROCHTTP_STATUS_CODE. &amp;amp;SYS_PROCHTTP_STATUS_PHRASE.;&lt;BR /&gt; %end;&lt;BR /&gt; %end;&lt;BR /&gt;%mend prochttp_check_return;&lt;/P&gt;
&lt;P&gt;/*** HEADER fil ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file head;&lt;BR /&gt;put "Authorization: ApiKey &amp;amp;_apiKey.";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/*** MULTIPART-FORM data ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file req termstr=CRLF;&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="BankId"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_bankid";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="Category"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_cat";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="Title"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_title";&lt;BR /&gt;put 'Content-Disposition: form-data; name="ExpirationDate"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_expdate";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="PublishDate"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_publdate";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="ShownDate"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_showndate";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="File"; filename='"&amp;amp;_binname.";&lt;BR /&gt;put 'Content-Type: application/octet-stream';&lt;BR /&gt;put;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;/*** Tilføjer binær fil ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file req mod recfm=n;&lt;BR /&gt;infile binfile recfm=n;&lt;BR /&gt;input c $CHAR1.;&lt;BR /&gt;put c $CHAR1. @@;&lt;BR /&gt;%_run(w);&lt;/P&gt;
&lt;P&gt;/*** Afslutning ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file req mod termstr=CRLF;&lt;BR /&gt;put / "--&amp;amp;_boundary.--";&lt;BR /&gt;%_run(w);&lt;/P&gt;
&lt;P&gt;proc http&lt;BR /&gt; /*URL="&lt;A href="https://ptsv2.com/t/kommunikationsplatform/post&amp;quot;*/" target="_blank"&gt;https://ptsv2.com/t/kommunikationsplatform/post"*/&lt;/A&gt;&lt;BR /&gt; URL="&lt;A href="https://kp-tot-inte.immeo.net/api/reports/update" target="_blank"&gt;https://kp-tot-inte.immeo.net/api/reports/update&lt;/A&gt;" &lt;BR /&gt; METHOD="PUT"&lt;BR /&gt; HEADERIN=head&lt;BR /&gt; CT="multipart/form-data; boundary=&amp;amp;_boundary"&lt;BR /&gt; in=req&lt;BR /&gt; out=resp;&lt;BR /&gt; DEBUG Level=1;&lt;BR /&gt; *HEADERS "Authorization "=" ApiKey &amp;amp;_apikey.";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;=sys_prochttp_status_code.;&lt;BR /&gt;%put &amp;amp;=sys_prochttp_status_phrase.;&lt;/P&gt;
&lt;P&gt;%prochttp_check_return(200);&lt;/P&gt;
&lt;P&gt;filename req clear;&lt;BR /&gt;filename resp clear;&lt;BR /&gt;filename binfile clear;&lt;BR /&gt;filename head clear;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 12:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522495#M215</guid>
      <dc:creator>jmic_nyk</dc:creator>
      <dc:date>2018-12-19T12:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: PROC HTTP - how do I encode for ÆØÅ</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522501#M216</link>
      <description>&lt;P&gt;You don't write what you are encoding from to. But my guess is that the file you are attempting to download is in uft-8 while SAS data is in wlatin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this is the case, the best option is to change the encoding from uft-8 to wlatin. You can do this using filename.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp "C:\Temp\utf8file.txt" encoding='utf-8';
filename resp1 "C:\Temp\wlatinfile.txt" encoding='wlatin1';

data _null_;
  infile resp;
  file resp1;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope it works&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 12:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522501#M216</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2018-12-19T12:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC HTTP - how do I encode for ÆØÅ</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522502#M217</link>
      <description>&lt;P&gt;First of all it's an upload (a PUT method) - the job is to post a file on a webserver.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, I have tried the encoding option with the filename - SAS fails big time. The webserver is UTF-8 (I think). ÆØÅ posted from my program is not ÆØÅ when recieved on the webserver (but something strange). I somehow have to enconde (some of) the request-file as UTF-8 before I PUT it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522502#M217</guid>
      <dc:creator>jmic_nyk</dc:creator>
      <dc:date>2018-12-19T13:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: PROC HTTP - how do I encode for ÆØÅ</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522508#M218</link>
      <description>&lt;P&gt;I still think it would work in reverse. Take a wlatin file and saving it as an utf-8 file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a little hard to test, as I can not run the code you posted. Maybe you can make a minimal working example?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/PROC-HTTP-how-do-I-encode-for-%C3%86%C3%98%C3%85/m-p/522508#M218</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2018-12-19T13:38:57Z</dc:date>
    </item>
  </channel>
</rss>

