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
延伸文章資訊
- 1convert 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, ...
- 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....
- 3Notepad++ - Batch convert ANSI GB2312 files to UTF8
Copy the files you want to convert to F:\temp\UTF8. (You may change your path in your script); In...
- 4Convert 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...
- 5How do you batch convert UTF-16 to UTF-8? - PTC Community
So, I have attempted to create a Windows Command Line batch file to open Arbortext Editor and exe...