I have serious problems with HOST
command. It seems that it doesn't recognize local characters properly. I wrote a piece of syntax to move files from one location to another. No matter encoding setting (chcp 65001
or chcp 1250
), I always get 001 code, even though I work with SPSS in Unicode mode only.
Fail 1 - no encoding specified:
host command = [
'move "C:\pąth_with_łóćął_ćhąrąćtęrś\fiłę.xlsx" "C:\Desktop\fiłę.xlsx"'
].
Fail 2 - local encoding specified:
host command = [
'chcp 1250'
'move "C:\pąth_with_łóćął_ćhąrąćtęrś\fiłę.xlsx" "C:\Desktop\fiłę.xlsx"'
].
Fail 3 - UTF-8 encoding specified:
host command = [
'chcp 65001'
'move "C:\pąth_with_łóćął_ćhąrąćtęrś\fiłę.xlsx" "C:\Desktop\fiłę.xlsx"'
].
Error message:
The HOST command 'CD /d C:\PROGRA~1\IBM\SPSS\STATIS~1\29 && move "C:\pąth_with_łóćął_ćhąrąćtęrś\fiłę.xlsx" "C:\Desktop\fiłę.xlsx"' terminated with exit status 001.
Does HOST
command not work anymore with local characters?
EDIT: the temporary and unconvenient solution is to globally change Windows region settings to UTF-8 for all languages. Still, even Windows warns this is a beta option, not to mention that each change there requires restart and it affects many other areas of daily usage (e.g. reading previously locally encoded Excel files).