convert2utf - PyPI
文章推薦指數: 80 %
***Batch mode***: Pass in a directory as the input, and all text files that meets the criteria underneath it will be converted to UTF8-encoding.
Skiptomaincontent
Switchtomobileversion
SearchPyPI
Search
convert2utf1.0.0
pipinstallconvert2utf==1.0.0
CopyPIPinstructions
Newerversionavailable(1.3.2)
Released:
Aug12,2017
Alightweighttoolthatconvertsnon-UTF-encoded(suchasGB2312,GBK,BIG5encoded)filestoUTF-8encodedfiles.Atthesametime,itcanalsoremoveByte-order-mark(BOM)inthosefiles.
Navigation
Projectdescription
Releasehistory
Downloadfiles
Projectlinks
Homepage
Statistics
GitHubstatistics:
Stars:
Forks:
Openissues/PRs:
ViewstatisticsforthisprojectviaLibraries.io,orbyusingourpublicdatasetonGoogleBigQuery
Meta
License:MITLicense(MIT)
Author:x1ang.li
Tags
target_encoding,
UTF-8,
UTF,
UTF8,
GBK,
GB2312,
Byte-Order-Mark,
BOM
Maintainers
x1angli
Classifiers
IntendedAudience
Developers
EndUsers/Desktop
License
OSIApproved::MITLicense
ProgrammingLanguage
Python::3
Python::3.3
Python::3.4
Python::3.5
Python::3.6
Python::Implementation::CPython
Topic
SoftwareDevelopment::Internationalization
TextEditors
TextProcessing::General
Projectdescription
Projectdetails
Releasehistory
Downloadfiles
Projectdescription
ConvertstextfilesorsourcecodefilesintoUTF-8encoding
============================================================
Thislightweighttoolconvertsnon-UTF-encoded(suchasGB2312,GBK,
BIG5encoded)filestoUTF-8encodedfiles.Itcaneitherbeexecuted
fromcommandline(CLI),orimportedintootherPythoncode.
Installation
------------
AutomaticInstallation(recommended)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.MakesurePython3,alongwithpip,isproperlyinstalled.
2.InyourCLI,execute``pipinstallconvert2utf``
ManualInstallation(fordevelopersonly)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.MakesurePython3isproperlyinstalled.
2.Clonethisproject,orjustdownloadthe.zipfilefromgithub.com
andunarchiveit
3.StartCLI(commandlineinterface),enterthelocalfolder
4.SetupPythonvirtualenvironmentwith``virtualenv...``or
``python-mvenv...``
5.Run:``pipinstall-rrequirements.txt``
Usage
-----
Thereisonlyonemandatoryargument:filename,whereyoucanspecify
thedirectoryorfilename.\****Batchmode***:Passinadirectoryas
theinput,andalltextfilesthatmeetsthecriteriaunderneathitwill
beconvertedtoUTF8-encoding.\****Singlefilemode***:Iftheinput
argumentisjustanindividualfile,itwouldbestraightforwardly
convertedtoUTF-8.
***Examples:***
-Changeall.txtfilestoUTF-8encoding.
``pythoncvt2utf.py"/path/to/your/repo"``
-Changeall.txtfilestoUTF-8encoding.Plusremovebyte-ordermarks
(a.k.a."BOM"sor"signature"s)fromexistingUTF-8files.
``pythoncvt2utf.py"/path/to/your/repo"-u``
-Changeall.csvfilestoUTF-8encoding.
SinceBOMareusedbysomeapplications(suchasMicrosoftExcel),we
wanttoaddBOM
``pythoncvt2utf.py"/path/to/your/repo"-b-u--extscsv``
-Convertall.php,.js,.java,.pyfilestoUTF-8encoding.
Meanwhile,thoseBOMsfromexistingUTF-encodedfileswillbe
**removed**.
``pythoncvt2utf.py"/path/to/your/repo"-u--extsphpjsjavapy``
-Convertall.cand.cppfilestoUTF-8withBOMs.
Thisactionwillalso**add**BOMstoexistingUTF-encodedfiles.
Per`issue#3
延伸文章資訊
- 1純文字檔案的編碼與內文批次轉換:Big5轉UTF-8 / Batch ...
純文字檔案的編碼與內文批次轉換:Big5轉UTF-8 / Batch convert Plain Text Files for Encoding and Content Replacing: B...
- 2convert all .txt files in a folder from ibm-850 unicode utf-8
Option Explicit 'Batch Convert of ibm-850 files to unicode utf-8 with BOM header Dim FS, Folder, ...
- 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...
- 4Notepad++ convert to UTF-8 multiple files - Stack Overflow
Need to batch convert a large quantity of text files from ANSI ...
- 5Convert 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...