Hi! I need to change encoding of some files to UTF-8 via Notepad++. I found this script for Python Script plugin which changes encoding of all files in the folder:
importos;importsys;filePathSrc="C:\\Users\\"# Path to the folder with files to convertforroot,dirs,filesinos.walk(filePathSrc):forfninfiles:iffn[-4:]=='.txt':# Specify type of the filesnotepad.open(root+"\\"+fn)notepad.runMenuCommand("Encoding","Convert to UTF-8")notepad.save()notepad.close()
It works good for me, except cases when files in the foler have unusual non-english character in the filename (like é, Ø, ß etc). When it comes to this files Notepad++ shows proposal to create new file "C:\Somefile.txt doesn't exist. Create it?" instead of open it.
Plese help to teach Notepad++ and this script open this files too.
P.S. I found advice on Notepad++ forum to set encoding of file path itself to UTF-8, but I'm not familiar with programming and don't know how to modify this particular script like this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi! I need to change encoding of some files to UTF-8 via Notepad++. I found this script for Python Script plugin which changes encoding of all files in the folder:
It works good for me, except cases when files in the foler have unusual non-english character in the filename (like é, Ø, ß etc). When it comes to this files Notepad++ shows proposal to create new file "C:\Somefile.txt doesn't exist. Create it?" instead of open it.
Plese help to teach Notepad++ and this script open this files too.
P.S. I found advice on Notepad++ forum to set encoding of file path itself to UTF-8, but I'm not familiar with programming and don't know how to modify this particular script like this.