Notepad++ - Batch convert ANSI GB2312 files to UTF8
文章推薦指數: 80 %
Copy the files you want to convert to F:\temp\UTF8. (You may change your path in your script); In Notepad++, go to Plugins - Python Script - ... Skiptomaincontent Share Getlink Facebook Twitter Pinterest Email OtherApps April02,2018 Notepad++-BatchconvertANSIGB2312filestoUTF8 IhavemanyANSIGB2312(SimplifiedChinese)textfiles. TheydonotdisplaycorrectlyinEnglishWindows.IwanttoconvertthemtoUTF8sotheywillbedisplayedcorrectly. ByusingNotepad++andPythonScriptPlugin,IcanautomatictheconversionofhundredsofANSI-GB2312formattedfiles. WARNING:thisscriptstraverseallthefilesinthefolder,andoverwritetheoriginalfile. Pleasecopyyouroriginalfiletoannewworkingfolder(e.g.F:\temp\UTF8). Pleasechecktheresultfilescarefullybeforedisposeyouroriginalfiles. Preparation InstallNotepad++(Testedwith32bitv7.5.6) DownloadPythonscriptplugin.(TestedwithPythonScript_Min_1.0.8.0.zip) CopythePythonscriptfilestoyourNotepad++installationfolder. RestartNotepad++. Thenyoushouldbeabletofind"Plugins-PythonScript" CreateanewPythonscript InNotepad++,gotoPlugins-PythonScript-NewScript. Enteranewfilename(e.g.Convert_ANSI_GB2312_to_UTF8),thenpressSave. Copyandpastethebelowscripttothenewfile. Thensaveit. Runthescript: CopythefilesyouwanttoconverttoF:\temp\UTF8. (Youmaychangeyourpathinyourscript) InNotepad++,gotoPlugins-PythonScript-Scripts-Convert_ANSI_GB2312_to_UTF8 ThenNotepad++willconvertallthefilesandsavetothesamefile. (BasedonPhilip'sblog:MassconvertaprojecttoUTF-8usingNotepad++) importos; importsys; filePathSrc="f:\\Temp\\UTF8" forroot,dirs,filesinos.walk(filePathSrc): forfninfiles: iffn[-4:]!='.jar'andfn[-5:]!='.ear'andfn[-4:]!='.gif'andfn[-4:]!='.jpg'andfn[-5:]!='.jpeg'andfn[-4:]!='.xls'andfn[-4:]!='.GIF'andfn[-4:]!='.JPG'andfn[-5:]!='.JPEG'andfn[-4:]!='.XLS'andfn[-4:]!='.PNG'andfn[-4:]!='.png'andfn[-4:]!='.cab'andfn[-4:]!='.CAB'andfn[-4:]!='.ico': notepad.open(root+"\\"+fn) console.write(root+"\\"+fn+"\r\n") #Doesnotwork-->notepad.runMenuCommand("Encoding","Charactersets","Chinese","GB2312(Simplified)") notepad.menuCommand(MENUCOMMAND.FORMAT_GB2312) #notepad.runMenuCommand("Encoding","ConverttoUTF-8-BOM") notepad.menuCommand(MENUCOMMAND.FORMAT_CONV2_UTF_8) #Reference:https://github.com/bruderstein/PythonScript/blob/master/PythonScript/src/NotepadPython.cpp notepad.save() notepad.close() Share Getlink Facebook Twitter Pinterest Email OtherApps EmailPost Comments Anonymoussaid… Thanksworked,IjusthadtochangethefirstencodingtoANSItomakemyfileschangetoUTF-8fromANSI. 10/02/2019 PopularPosts April08,2018 EnablesshandtelnetonXiaomiMiWifiR1CMwithoutregisteringwithXiaomi Share Getlink Facebook Twitter Pinterest Email OtherApps PostaComment SearchThisBlog Archive 2022 13 October 3 June 1 May 3 April 3 March 2 January 1 2021 4 December 1 August 1 May 1 March 1 2020 5 November 2 August 2 March 1 2019 3 August 2 March 1 2018 13 July 1 June 4 May 1 April 4 CentOS7withRDPanddocker EnablesshandtelnetonXiaomiMiWifiR1CMwithou... Fortigate-AirPrintacrosstwosubnet/region(usi... Notepad++-BatchconvertANSIGB2312filestoUTF8 March 1 January 2 2017 18 December 1 November 2 October 3 August 2 July 1 April 1 March 1 February 4 January 3 2016 19 December 1 November 1 October 2 July 1 June 3 May 1 April 2 March 3 January 5 2015 16 November 2 September 2 July 9 May 2 March 1 2014 29 November 1 October 1 September 2 August 4 June 1 April 1 March 7 February 3 January 9 2013 54 December 4 November 5 October 3 September 4 August 2 July 4 June 3 May 7 April 6 March 5 February 7 January 4 2012 80 December 8 November 20 October 5 September 7 August 6 July 1 June 5 May 12 April 3 March 5 February 3 January 5 2011 60 December 14 November 35 October 8 March 1 January 2 2010 15 December 1 November 2 August 2 July 4 June 1 May 1 March 1 February 2 January 1 2007 2 July 1 June 1 Showmore Showless Labels android1 Avaya9 business6 career1 customerservice1 economics1 education3 entrepreneurship9 Excel3 Exchange9 finance1 hardware1 health1 HKSCS1 iis6 investment5 iPhone3 it20 ITIL8 Linux19 management23 marketing3 mobile1 MSSQL22 netscreen1 networking15 NICE1 OpenVPN1 Oracle25 Outdoor1 Parenting2 pfsense1 photography1 ProjectManagement1 PropertyMarket1 Realestate1 risk2 SAN1 security12 self-help1 servers2 siebel4 Visio1 vmware14 windows39 Showmore Showless ReportAbuse Links 恆指ADR 恆指PE 牛熊証街貨量 王維基 聯強EMBA 林奮強 RichardBranson 港匯美匯 施永青
延伸文章資訊
- 1Convert multiple files to UTF-8 encoding with Notepad++
This file will search all files and folders within a given directory, and use Notepad++ to conver...
- 2How To Batch Convert Text Files To UTF-8 Encoding
UTFCast is a small tool for Windows that lets you batch convert all text files to UTF-8 encoding....
- 3Batch convert encoding in files - Super User
UTFCast is a Unicode converter that lets you batch convert all text files to UTF encodings with j...
- 4純文字檔案的編碼與內文批次轉換:Big5轉UTF-8 / Batch ...
純文字檔案的編碼與內文批次轉換:Big5轉UTF-8 / Batch convert Plain Text Files for Encoding and Content Replacing: B...
- 5Notepad++ convert to UTF-8 multiple files - Stack Overflow
Need to batch convert a large quantity of text files from ANSI ...