In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how VBS implements the GB2312,UTF-8,Unicode,BIG5 transcoding tool. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Specific code:
The code is as follows:
The CMD command line transcoding tool includes GB2312,UTF-8,Unicode,BIG5... Support drag and drop, save the file as *'* CodeChange.vbs BY: yongfa365' * GB2Ue.vbs BY: fastslz' * = * aCode = "GB2312" bCode = "Unicode" Show = "this script only supports the conversion from" & aCode& "to" & bCode& ". Please drag and drop a single file to be converted to this file! "Usage1 =" syntax 1:GB2Ue.vbs [drive] [directory] [file name] (directly replace the original file mode) "Usage2 =" syntax 2:GB2Ue.vbs [drive] [directory] [file name] [target drive] [new name] / Y "Usage3 =" if the target new file already exists, it will be replaced directly after using the / Y parameter without prompting whether to rewrite it! "Usage4 =" command line transcoding tool BY: fastslz "Set objArgs=WScript.ArgumentsSet fso=CreateObject (" Scripting.FileSystemObject ") if objArgs.Count=0 ThenMsgBox Show & vbCrLf&vbCrLf& Usage1 & vbCrLf& Usage2 & vbCrLf& Usage3, vbInformation, Usage4Wscript.Quitend ifif not objArgs.Count
< 3 ThenOptions="/y"ignoring = StrComp(objArgs(2), Options, vbTextCompare)if ignoring = 0 ThenSourcefile=objArgs(0)Getfile=objArgs(1)elseMsgBox "文件数量或参数太多,拖拽批量处理请用 ANSI2Unicode.vbs ", vbInformation, "程序意外终止"Wscript.Quitend ifelseif not objArgs.Count < 2 ThenSourcefile=objArgs(0)Getfile=objArgs(1)if fso.FileExists(objArgs(1)) thenChoice = MsgBox ("待处理文件""+Sourcefile+"" ==>Target file "+ Getfile+"& vbCrLf&" object file already exists. Do you want to overwrite the existing file? + objArgs (1) + "", vbQuestion+vbYesNo, "whether to rewrite") if Choice = vbYes ThenGetfile=objArgs (1) elseWscript.Quitend ifend ifelseSourcefile=objArgs (0) Getfile=objArgs (0) end ifend ifCall CheckCode (Sourcefile) Call WriteToFile (Getfile, ReadFile (Sourcefile, aCode), bCode) Wscript.QuitFunction ReadFile (Sourcefile, CharSet) Dim StrSet stm = CreateObject ("Adodb.Stream") stm.Type = 2stm.mode = 3stm.charset = CharSetstm.Openstm.loadfromfile SourcefileStr = stm.readtextstm.CloseSet stm = NothingReadFile = StrEnd FunctionFunction WriteToFile (Getfile, Str) CharSet) Setstm = CreateObject ("Adodb.Stream") stm.Type = 2stm.mode = 3stm.charset = CharSetstm.Openstm.WriteText Strstm.SaveToFile Getfile,2stm.flushstm.CloseSet stm = NothingEnd FunctionFunction CheckCode (Sourcefile) Dim slzset slz = CreateObject ("Adodb.Stream") slz.Type = 1slz.Mode = 3slz.Openslz.Position = 0slz.Loadfromfile SourcefileBin=slz.read (2) if AscB (MidB (Bin,1,1)) & HEF and AscB (MidB (Bin,2,1)) = & HBB ThenCodes= "UTF-8" elseif AscB (MidB (Bin) ) = & HFF and AscB (MidB (Bin,2,1)) = & HFE ThenCodes= "Unicode" elseCodes= "GB2312" end ifif not aCode = Codes ThenMsgBox "pending file"& Sourcefile&" & vbCrLf& "the original code of the file is not" & aCode& " This script only supports conversion from "& aCode&" to "& bCode&"! ", vbInformation," error termination "WScript.Quitend ifslz.Closeset slz = NothingEnd Function, this is the end of the article on" how VBS implements the GB2312,UTF-8,Unicode,BIG5 transcoding tool ". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.