使用Notepad++實現批量將ANSI轉成為UTF-8編碼


http://blog.sina.com.cn/s/blog_5f4150730101b3ok.html

使用Trados2011翻譯英文html后,如果是單個文件,可在另存譯文時選擇Encoding為utf8,但是項目文件導出時卻沒有選項可以實現編碼的轉換。

 
方案:可使用Notepad++實現
 
  1. 選擇Plugins->Plugin Manager->Show Plugin Manager
  2. 安裝 Python Script。安裝后重啟Notepad++
  3. 一次選擇 Plugins->Python Script->New script.
  4. 命名為ansi2utf8,復制以下代碼

convertToUTF8.py

import os;
import sys; 
filePathSrc="C:\\decompile\\" # Path to the folder with files to convert 
for root, dirs, files in os.walk(filePathSrc): 
 for fn in files: if fn[-4:] == '.htm': # Specify type of the files 
        notepad.open(root + "\\" + fn) 
        notepad.runMenuCommand("Encoding", "Convert to UTF-8") notepad.save()
        notepad.close()
 
參考:http://stackoverflow.com/questions/7256049/notepad-converting-ansi-encoded-file-to-utf-8

import os;
import sys; 
filePathSrc="D:\\Eclipse\\eclipse-standard-kepler-SR1-win32\\workspace\\ALBasicServer-master\\ALBasicServer\\src\\ALBasicServer" # Path to the folder with files to convert 
for root, dirs, files in os.walk(filePathSrc): 
   for fn in files : 
       if fn[-4:] == '.java' :
        notepad.open(root + "\\" + fn) 
        notepad.runMenuCommand("Encoding", "Convert to UTF-8") 
        notepad.save()
        notepad.close()
 
         

 

還不如直接下載工具呢:http://www.crsky.com/soft/29270.html    好用!!!!!!!!!!

TextEncoding.exe

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM