Probao sam neke programe. Ovaj je dobar ali samo
za TXT files
Isprobao sam neke *.py skripte za Notepad++ ali nikako da ih prilagodim mojim potrebama. Ova mi se čini najbolja od svega što sam našao.
Ima li netko programerskog znanja da prepravi ovu skriptu. Folderi i subfolderi/*.html files mi se nalaze u C:\Temp
Gdje može biti greška. Notepad++ je verzija 6.8.1
Ovdje se konvertira u "UTF-8 without BOM" a meni treba "UTF-8".
Međutim, skripta ne radi uopće?
Kreirao sam Python/New Script i snimio.
Resetirao Notepad++ i pokrenuo skriptu, ali ništa se ne događa.
Code:
# Python script for bulk conversion of HTML and PHP files to UTF-8 without BOM using Notepad++
#
# @author Zion Ng <
[email protected]>
# @link [Source] https://github.com/zionsg/stan...-scripts/tree/master/CrawlSite
# @see http://notepad-plus-plus.org/ for Notepad++
# @see http://npppythonscript.sourceforge.net/ for PythonScript plugin for Notepad++
#
import os;
import sys;
# Modify path and extensions of files to convert here
path = 'C:\\Temp'
# path = 'C:\\Temp\\files'
extensions = ['.htm', '.html', '.php', '.phtml']
# Function to convert files in dir to UTF-8 without BOM using Notepad++
def processDirectory(args, dir, files):
console.write('Directory: ' + dir + "\r\n")
for file in files:
for extension in extensions:
if file[-len(extension):] == extension:
console.write(' ' + file + "\r\n")
notepad.open(dir + "\\" + file)
notepad.runMenuCommand('Encoding', 'Convert to UTF-8 without BOM')
notepad.save()
notepad.close()
break
# Run script
# processDirectory() will be called recursively for each directory encountered
os.path.walk(path, processDirectory, None)
console.write("\r\n" + 'DONE!' + "\r\n")