def setUp(self): global counter counter = 0 notepad.new() notepad.runMenuCommand("Encoding", "Convert to ANSI") editor.write(u'abc123 def5432 gh98\r\näbc123 üef5432 öh98\r\n'.encode( 'windows-1252'))
def convert2uft8(filename): #print filename filename = filename.encode("UTF-8") notepad.open(filename) notepad.runMenuCommand("Encoding", "Convert to UTF-8") notepad.save() notepad.close() print filename
def setUp(self): notepad.new() notepad.runMenuCommand("Encoding", "Convert to ANSI") editor.write( u'Here is some text\r\nWith some umlauts XäXüXö\r\n'.encode( 'windows-1252'))
import os import sys from Npp import notepad filePathSrc=r"D:\Documents\PRM\selected-tiantian\mlf" for dir,dirs,files in os.walk(filePathSrc): for fn in files: if fn.endswith(".mlf"): notepad.open(os.path.join(dir,fn)) notepad.runMenuCommand("Encoding","Convert to UTF-8 without BOM")
import os import sys from Npp import notepad filePathSrc = "C:\\server\\encode" for root, dirs, files in os.walk(filePathSrc): for fn in files: if fn[-4:] == '.yml': notepad.open(root + "\\" + fn) notepad.runMenuCommand("Encoding", "Convert to ANSI") notepad.save() notepad.close()
import os import sys from Npp import notepad filePathSrc = "D:/training/twg_copy/Contract Detail 5/" #print "ashu" for root, dirs, files in os.walk(filePathSrc): for fn in files: if (fn[-4:] == '.csv'): notepad.open (root + "/" + fn) notepad.runMenuCommand("Macro", "convert") #notepad.save() notepad.runMenuCommand("Encoding", "Convert to UTF-8") notepad.save() #notepad.messageBox("{}{}".format(root+"\\"+fn[:-4],'_trans.csv'),0,"Done") notepad.messageBox("File: %s " % (fn)) notepad.close() #notepad.saveAs("{}{}".format(root+"\\"+fn[:-4],'_trans.csv')) #notepad.close()