remove bom from utf-8 files - gists · GitHub
文章推薦指數: 80 %
remove bom from utf-8 files. GitHub Gist: instantly share code, notes, and snippets. Skiptocontent Allgists BacktoGitHub Signin Signup Sign in Sign up {{message}} Instantlysharecode,notes,andsnippets. svortex/bomremover CreatedMay23,2013 Star 0 Fork 0 Star Code Revisions 1 Embed Whatwouldyouliketodo? Embed Embedthisgistinyourwebsite. Share Copysharablelinkforthisgist. Clonevia HTTPS ClonewithGitorcheckoutwithSVNusingtherepository’swebaddress. LearnmoreaboutcloneURLs DownloadZIP removebomfromutf-8files Raw bomremover ThisfilecontainsbidirectionalUnicodetextthatmaybeinterpretedorcompileddifferentlythanwhatappearsbelow.Toreview,openthefileinaneditorthatrevealshiddenUnicodecharacters. LearnmoreaboutbidirectionalUnicodecharacters Showhiddencharacters #!/bin/bash # #BOMRemoverv1.0 # #(c)2011,AdilAliyev #NEATSLLC #Baku/Azerbaijan # #[email protected] # functionusage(){ echo"BOMRemoverv1.0" echo"" echo"(c)2011,AdilAliyev" echo"" echo"Usage:" echo"bomremover[-r]files..." echo"-rScansubdirectories." echo"" } RECURSIVE_MODE=false whilegetopts"rh"opt do case$optin r)RECURSIVE_MODE=true;; h)usage;exit1;; *)echo"Illegaloption.";exit2;; esac done FILES="$@" if[!-n"$FILES"];then echo"bomremover:Nofilespecified" exit1 fi color_greenf="\033[01;32m" color_reset="\033[0m" if[$RECURSIVE_MODE==true];then find.-typef|whilereadfile do sed-i's/^\xef\xbb\xbf//'"$file" echo-e"$file\t\t\t${color_greenf}done.${color_reset}"; done else foriin$FILES;do sed-i's/^\xef\xbb\xbf//'$i echo-e"$i\t\t\t${color_greenf}done.${color_reset}"; done fi #EOF Signupforfree tojointhisconversationonGitHub. Alreadyhaveanaccount? Signintocomment Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.
延伸文章資訊
- 1Remove byte-order mark from the beginning of the file
Open the file in Visual Studio Code · Click the UTF-8 with BOM text at the bottom right of the sc...
- 2remove bom from utf-8 files - gists · GitHub
remove bom from utf-8 files. GitHub Gist: instantly share code, notes, and snippets.
- 3How can I remove the BOM from a UTF-8 file?
- 4[PHP] 無痛遠離UTF-8 BOM - 工程的日子每天都很師
會有這樣的問題發生,是因為網站專案中有使用到UTF8 含BOM 編碼的檔案,那 ... <?php //remove the utf-8 boms //by magicbug at gmail ...
- 5How to display and remove BOM in utf-8 encoded file
Hi, I developed a website with Vim, working both on linux and windows and never had any problems....