Skip to content Skip to sidebar Skip to footer

Notepad++ Convert To Utf-8 Multiple Files

The function 'Convert to UTF-8 without BOM' of Notepad++ is really nice. But I have 200 files and all of them need to be coverted. Therefor I found this little python script: impor

Solution 1:

Here is what worked for me:

Go to Notepad++ -> Plugins -> Plugins Admin.

Find and install Python Script plugin.

Create new python script with Plugins -> Python Script -> New script.

Insert this code into your script:

import os;
import sys;
filePathSrc="C:\\Users\\YourUsername\\Desktop\\txtFolder"for root, dirs, files in os.walk(filePathSrc):
    for fn in files:
      if fn[-4:] == '.txt' or fn[-4:] == '.csv':
        notepad.open(root +"\\"+ fn)
        console.write(root +"\\"+ fn +"\r\n")
        notepad.runMenuCommand("Encoding", "Convert to UTF-8")
        notepad.save()
        notepad.close()

Replace C:\\Users\\YourUsername\\Desktop\\txtFolder with path to your Windows folder where your files are.

Script works with .txt and .csv files and ignores all other files in folder.

Run script with Plugins -> Python Scripts -> Scripts -> name of your script

Solution 2:

Got my mistake. My notepad is in german. So take care if it's called "Encoding" or in my case "Kodierung" and "Convert to UTF-8 without BOM" is "Konvertiere zu UTF-8 ohne BOM"

That helped me out!

Solution 3:

You also can record and play back a macro here. Tthat's what worked for me since the PlugIn manager is somehow broken I don't have Python available.

  • drag a set of files (or all - I think there is a limit in the maximum number of files) into notepad++
  • Macro -> Start recording
  • do the conversion
  • save file
  • close file
  • Macro -> Stop recording

You can play back the macro by selecting

  • Macro -> Run a Macro Multiple Times
  • Enter a value such that all files are processed

Since the files are closed after processing, you will know which files have not been processed yet.

Post a Comment for "Notepad++ Convert To Utf-8 Multiple Files"