<?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 foptname failed to return value when filename contains MBCS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928791#M365463</link>
    <description>&lt;P&gt;When using function foptname and filename contains Chinese character, it failed to return value.&amp;nbsp;The prerequisites are:&lt;/P&gt;
&lt;P&gt;1. Windows OS;&lt;/P&gt;
&lt;P&gt;2. SAS 9.4 M8;&lt;/P&gt;
&lt;P&gt;3. UTF-8 encoded SAS session;&lt;/P&gt;
&lt;P&gt;And the active code page of my Windows OS is 936, which means simplified Chinese, a friend think this could be related.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using foptname and finfo to get file attributes, with English file name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _dummy_ "C:\Profiles\Work\temp\hello.sas";
data _null_;
 fid=fopen('_dummy_');
 if fid then do;
   do i=1 to foptnum(fid);
     foptname=foptname(fid,i);
     finfo=finfo(fid,foptname);
     put foptname ":" finfo;
   end;
   fid=fclose(fid);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;文件名 :C:\Profiles\Work\temp\hello.sas
RECFM :V
LRECL :32767
文件大小（字节） :634
上次修改时间 :2024年05月16日 10时06分17秒
创建时间 :2024年05月16日 10时06分17秒
&lt;/PRE&gt;
&lt;P&gt;The output is cool.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With Chinese file name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _dummy_ "C:\Profiles\Work\temp\你好.sas";
data _null_;
 fid=fopen('_dummy_');
 if fid then do;
   do i=1 to foptnum(fid);
     foptname=foptname(fid,i);
     finfo=finfo(fid,foptname);
     put foptname ":" finfo;
   end;
   fid=fclose(fid);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;文件名 :C:\Profiles\Work\temp\你好.sas
RECFM :V
LRECL :32767
  :
  :
  :&lt;/PRE&gt;
&lt;P&gt;Missing the last 3 output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With Janpenese file name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _dummy_ "C:\Profiles\Work\temp\こんにちは.sas";
data _null_;
 fid=fopen('_dummy_');
 if fid then do;
   do i=1 to foptnum(fid);
     foptname=foptname(fid,i);
     finfo=finfo(fid,foptname);
     put foptname ":" finfo;
   end;
   fid=fclose(fid);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;文件名 :C:\Profiles\Work\temp\こんにちは.sas
RECFM :V
LRECL :32767
  :
  :
  :
&lt;/PRE&gt;
&lt;P&gt;Missing the last 3 output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why I cann't get right output when&amp;nbsp;filename contains MBCS? Is there a robust way to get file attributes&amp;nbsp;regardless of the encoding or OS? Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS1: Under euc-cn(whichc means simplified Chinese)&amp;nbsp;encoded SAS session, Windows OS, the problem just disappear.&lt;/P&gt;
&lt;P&gt;PS2: Under utf-8 encoded SAS session, Linux OS, the problem just disappear.&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 04:32:05 GMT</pubDate>
    <dc:creator>whymath</dc:creator>
    <dc:date>2024-05-17T04:32:05Z</dc:date>
    <item>
      <title>foptname failed to return value when filename contains MBCS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928791#M365463</link>
      <description>&lt;P&gt;When using function foptname and filename contains Chinese character, it failed to return value.&amp;nbsp;The prerequisites are:&lt;/P&gt;
&lt;P&gt;1. Windows OS;&lt;/P&gt;
&lt;P&gt;2. SAS 9.4 M8;&lt;/P&gt;
&lt;P&gt;3. UTF-8 encoded SAS session;&lt;/P&gt;
&lt;P&gt;And the active code page of my Windows OS is 936, which means simplified Chinese, a friend think this could be related.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using foptname and finfo to get file attributes, with English file name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _dummy_ "C:\Profiles\Work\temp\hello.sas";
data _null_;
 fid=fopen('_dummy_');
 if fid then do;
   do i=1 to foptnum(fid);
     foptname=foptname(fid,i);
     finfo=finfo(fid,foptname);
     put foptname ":" finfo;
   end;
   fid=fclose(fid);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;文件名 :C:\Profiles\Work\temp\hello.sas
RECFM :V
LRECL :32767
文件大小（字节） :634
上次修改时间 :2024年05月16日 10时06分17秒
创建时间 :2024年05月16日 10时06分17秒
&lt;/PRE&gt;
&lt;P&gt;The output is cool.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With Chinese file name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _dummy_ "C:\Profiles\Work\temp\你好.sas";
data _null_;
 fid=fopen('_dummy_');
 if fid then do;
   do i=1 to foptnum(fid);
     foptname=foptname(fid,i);
     finfo=finfo(fid,foptname);
     put foptname ":" finfo;
   end;
   fid=fclose(fid);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;文件名 :C:\Profiles\Work\temp\你好.sas
RECFM :V
LRECL :32767
  :
  :
  :&lt;/PRE&gt;
&lt;P&gt;Missing the last 3 output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With Janpenese file name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _dummy_ "C:\Profiles\Work\temp\こんにちは.sas";
data _null_;
 fid=fopen('_dummy_');
 if fid then do;
   do i=1 to foptnum(fid);
     foptname=foptname(fid,i);
     finfo=finfo(fid,foptname);
     put foptname ":" finfo;
   end;
   fid=fclose(fid);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;文件名 :C:\Profiles\Work\temp\こんにちは.sas
RECFM :V
LRECL :32767
  :
  :
  :
&lt;/PRE&gt;
&lt;P&gt;Missing the last 3 output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why I cann't get right output when&amp;nbsp;filename contains MBCS? Is there a robust way to get file attributes&amp;nbsp;regardless of the encoding or OS? Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS1: Under euc-cn(whichc means simplified Chinese)&amp;nbsp;encoded SAS session, Windows OS, the problem just disappear.&lt;/P&gt;
&lt;P&gt;PS2: Under utf-8 encoded SAS session, Linux OS, the problem just disappear.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 04:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928791#M365463</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2024-05-17T04:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: foptname failed to return value when filename contains MBCS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928796#M365465</link>
      <description>&lt;P&gt;Open a track with SAS technical support. But since the return of FOPTNUM, FOPTNAME and FINFO is OS-dependent, this might be a fault in Windows itself.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 07:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928796#M365465</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-05-17T07:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: foptname failed to return value when filename contains MBCS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928888#M365483</link>
      <description>&lt;P&gt;What's your SAS LOCALE settings for these tests? You can check using this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option = locale;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 May 2024 00:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928888#M365483</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-05-18T00:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: foptname failed to return value when filename contains MBCS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928969#M365537</link>
      <description>Thank you, it is ZH_CN</description>
      <pubDate>Mon, 20 May 2024 02:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/foptname-failed-to-return-value-when-filename-contains-MBCS/m-p/928969#M365537</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2024-05-20T02:38:03Z</dc:date>
    </item>
  </channel>
</rss>

