[Rd] 答复: R-4.3 version list.files function could not work correctly in chinese

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Tue Aug 15 16:14:16 CEST 2023


Dear 叶月光,

as discussed on this thread, Ivan Krylov found a bug in R, which could 
be causing the problem you have run into. To confirm this is the cause, 
could you please check outside R (say in explorer) if you have any file 
with a very long name in the directory? And if so, does moving that file 
away make the problem disappear? Files with up to 80 characters couldn't 
trigger this bug.

A workaround for this bug is not to use file names with more than 80 
(possibly all Chinese) characters.

The content of a file (or whether the content is in UTF-8 or not) cannot 
be influencing this problem directly, neither list.files() nor Windows 
looks into the files when listing them.

The bug Ivan found is not a regression: older versions of R may crash 
when you have such long file names. So there would be no point staying 
with an older version to overcome this problem: the only reliable 
work-around I can think of is use reasonably short file names.

Best
Tomas

On 8/14/23 03:45, 叶月光 wrote:
> Rterm.exe  test result。
>
>> a  =  readline()
> D:\Project_Delivery\
>>
>>   list.files(a,recursive = T)
> [1] "2022(1).xlsx"
> [2] "conf_custom_wf_wt_map_202308091545.csv"
> [3] ".R"
> [4] ".xlsx"
> [5] "_.xlsx"
> [6] ".xlsx"
> [7] " (3).xlsx"
> [8] "20230222113605379(1).xlsx"
> [9] "_2022_20230811.docx"
>
> All  the file names which contains the Chinese  can not be printed.
> The result of RGUI and RStudio are the same:
>
>
>> a  =  readline()
> D:\Project_Delivery\广核
>>
>>   list.files(a,recursive = T)
> [1] "2022年度金风慧能第三方模型预警明细表(1).xlsx" "conf_custom_wf_wt_map_202308091545.csv"
>
>
> 发件人: yu gong [mailto:yugong using outlook.com]
> 发送时间: 2023年8月13日 17:36
> 收件人: 叶月光 <yeyueguang using goldwind.com>; r-devel using r-project.org
> 主题: Re: R-4.3 version list.files function could not work correctly in chinese
>
> Could you test it on RGui and Rterm first, see it work or not. then try RStudio?
>
> ________________________________
> From: R-devel <r-devel-bounces using r-project.org<mailto:r-devel-bounces using r-project.org>> on behalf of 叶月光 <yeyueguang using goldwind.com<mailto:yeyueguang using goldwind.com>>
> Sent: Friday, August 11, 2023 11:41
> To: r-devel using r-project.org<mailto:r-devel using r-project.org> <r-devel using r-project.org<mailto:r-devel using r-project.org>>
> Subject: [Rd] R-4.3 version list.files function could not work correctly in chinese
>
>       ��ã�
>            ����R-4.3�汾�����°汾��R������list.files������ȡ����ȫ���ļ���Ϣ��BUG�����ж���û��ᵽ������⣬ϣ���Ľ���
> r4.3�汾��dir������ȡ����ȫ���ļ� - COS��̳ | ͳ��֮�� | ͳ�������ݿ�ѧ��̳ (cosx.org)<https://d.cosx.org/d/424356-r43ban-ben-zhong-dirhan-shu-huo-qu-bu-liao-quan-bu-wen-jian/11><ttps://d.cosx.org/d/424356-r43ban-ben-zhong-dirhan-shu-huo-qu-bu-liao-quan-bu-wen-jian/11%3e>
>            �����������ļ��б��ȡ��ʱ��
>
>          [[alternative HTML version deleted]]
> 以下内容是邮件系统安全提示:
> 在电子邮件中索要个人信息、账号密码、银行卡信息、求助、补助、钱款转账等情况为“钓鱼邮件”或者“病毒邮件”,无需响应,并请立即删除。
> 如遇到邮件安全问题,请联系数字化中心 ITSecurity using goldwind.com>
> ———————————————
> Email system security tips:
> The use of emails to collect personal information, account passwords, bank card information, help, subsidies, money transfers, etc. is "phishing email" or "virus email", no response is required, and please delete it immediately.
> If you encounter email security issues, please contact ITSecurity using goldwind.com.<mailto:TSecurity using goldwind.com.>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list