Skip to content

Instantly share code, notes, and snippets.

@jontey
Created May 31, 2018 18:49
Show Gist options
  • Save jontey/93dce03ce39f49ade3de53e8885085b9 to your computer and use it in GitHub Desktop.
Save jontey/93dce03ce39f49ade3de53e8885085b9 to your computer and use it in GitHub Desktop.
Convert files with selected extensions to UTF-8 using Notepad++ and Python Script plugin
import os;
import sys;
filePathSrc = notepad.prompt('Enter the path to the folder where the files are located', 'Convert files to UTF-8', 'C:\\');
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-3:] == '.js' or fn[-4:] == '.php' or fn[-4:] == '.htm' or fn[-5:] == '.html' or fn[-4:] == '.css' or fn[-4:] == '.txt':
notepad.open(root + "\\" + fn)
console.write(root + "\\" + fn + "\r\n")
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.save()
notepad.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment