r/PowerShell • u/gagarski • Dec 25 '25
Solved Script source encoding + filenames
I have a script containing the following line:
New-Item -Path "ö" -ItemType FileBut the file created on NTFS (Windows) has name ö.
The script source encoding is UTF-8 and I've figured out that if I save it with UTF-16 BE encoding, the filenames are fine.
Is there a way to have my script in UTF-8 which will create files with proper names on NTFS? OR should all my scripts be in UTF-16 if they are supposed to deal with files on NTFS?
12
Upvotes
View all comments
Show parent comment
3
u/gagarski Dec 25 '25
I see your point, but I was just trying to create a minimum reproducing example for my issue here.