What is the difference between utf-8 and utf-8-sig?
文章推薦指數: 80 %
"sig" in "utf-8-sig" is the abbreviation of "signature" (i.e. signature utf-8 file). Using utf-8-sig to read a file will treat the BOM as ... Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. LearnmoreaboutCollectives Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. LearnmoreaboutTeams Whatisthedifferencebetweenutf-8andutf-8-sig? AskQuestion Asked 3years,2monthsago Modified 1monthago Viewed 37ktimes 40 IamtryingtoencodeBanglawordsinpythonusingpandasdataframe.Butasencodingtype,utf-8isnotworkingbututf-8-sigis.Iknowutf-8-sigiswithBOM(Byteordermark).Butwhyisthiscalledutf-8-sigandhowitworks? pythonpandasencoding Share Improvethisquestion Follow askedJul22,2019at20:00 JuBaerADJuBaerAD 54611goldbadge44silverbadges77bronzebadges 5 2 Ibelievethisisaduplicate:stackoverflow.com/questions/2223882/… – juanpa.arrivillaga Jul22,2019at20:08 2 WelcometoStackOverflow.ThissitemakesitclearthattheBOM(ByteOrderMark)isa"signature,"hencethe"sig"inthename.Thisquestionwithitsanswersexplainitsreasonsandhowitworks.HereisPythondocumentationonthetopic.Istheresomethinginparticularyoudonotunderstand? – RoryDaulton Jul22,2019at20:10 Possibleduplicateofpythonutf-8-sigBOMinthemiddleofthefilewhenappendingtotheend – RoryDaulton Jul22,2019at20:10 1 Idon'tfindanythingrelatedtothe'sig'part.That'swhyIaskedthisquestion. – JuBaerAD Jul25,2019at6:32 7 Thisisaperfectlyvalidquestion. – Nobilis Feb21,2020at10:43 Addacomment | 1Answer 1 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 43 "sig"in"utf-8-sig"istheabbreviationof"signature"(i.e.signatureutf-8file). Usingutf-8-sigtoreadafilewilltreattheBOMasmetadatathatexplainshowtointerpretthefile,insteadofaspartofthefilecontents. Share Improvethisanswer Follow editedAug29at12:55 LutzPrechelt 34k99goldbadges6060silverbadges8484bronzebadges answeredMar10,2020at9:10 eeeeee 44144silverbadges66bronzebadges Addacomment | YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedpythonpandasencodingoraskyourownquestion. TheOverflowBlog HowtoearnamillionreputationonStackOverflow:beofservicetoothers Therightwaytojobhop(Ep.495) FeaturedonMeta BookmarkshaveevolvedintoSaves Inboximprovements:markingnotificationsasread/unread,andafiltered... Revieweroverboard!Orarequesttoimprovetheonboardingguidancefornew... CollectivesUpdate:RecognizedMembers,Articles,andGitLab Shouldweburninatethe[script]tag? Linked 974 What'sthedifferencebetweenUTF-8andUTF-8withBOM? 7 Howtoreadcsvfilefroms3bucketinAWSLambda? 8 pythonutf-8-sigBOMinthemiddleofthefilewhenappendingtotheend 1 Cleaning/decodingscrapedtextinbeautifulsoup Related 3130 Whatdoes**(doublestar/asterisk)and*(star/asterisk)doforparameters? 4405 Differencebetween@staticmethodand@classmethod 12289 Whatdoesthe"yield"keyworddo? 3113 WhatisthedifferencebetweenPython'slistmethodsappendandextend? 674 WhatisthedifferencebetweenUTF-8andUnicode? 3218 "LeastAstonishment"andtheMutableDefaultArgument 3475 Whatisthedifferencebetween__str__and__repr__? 1482 Whatarethedifferencesbetweentype()andisinstance()? 1263 Whatisthedifferencebetweennull=Trueandblank=TrueinDjango? 1819 Whatisthedifferencebetweenvenv,pyvenv,pyenv,virtualenv,virtualenvwrapper,pipenv,etc? HotNetworkQuestions 2016PutnamB6difficultsummationproblem Howtotellifmybikehasanaluminumframe Shouldselectedoptionsberemovedfromsingle-andmulti-selectdropdownlists? Howtoelegantlyimplementthisoneusefulobject-orientedfeatureinMathematica? Traditionally,andcurrently,whatstopshumanvotecountersfromalteringballotstomakethem'Spoilt/Invalidvotes? ShouldIusepwdortildeplus(~+)? What'sthedifferencebetween'Dynamic','Random',and'Procedural'generations? Could"nocloning"beusedasadefenceforquantumencryption? WhatistheAmericanequivalentof"Icalledmymomtoaskafterher"? MakeaCourtTranscriber Whydoesthesameelectrontransitionreleasephotonsofdifferentfrequenciesforsomeelements? Whoorwhatis"Nampat"inthechantoftheOrcsintheRingsofPower? Whydostringhashcodeschangeforeachexecutionin.NET? Whattranslation/versionoftheBiblewouldChaucerhaveread? PacifistethosblockingmyprogressinStellaris HowdoIdownloadmacOSMontereyonunsupportedMac? CommonPlotLegendsforDensityPlot DoestheDemocraticPartyofficiallysupportrepealingtheSecondAmendment? WhatdothecolorsindicateonthisKC135tankerboom? IfthedrowshadowbladeusesShadowSwordasarangedattack,doesitthrowasword(thatitthenhastoretrievebeforeusingitagain)? SomeoneofferedtaxdeductibledonationasapaymentmethodforsomethingIamselling.AmIgettingscammed? 9dotsthatare3by3,continuethepattern Myfavoriteanimalisa-singularandpluralform Theunusualphrasing"verb+the+comparativeadjective"intheLordoftheRingsnovels morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-py Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1What is the difference between utf-8 and utf-8-sig?
"sig" in "utf-8-sig" is the abbreviation of "signature" (i.e. signature utf-8 file). Using utf-8-...
- 2【Python 必會技巧】利用utf-8-sig 編碼格式解決寫入csv 文件 ...
先舉個例子,分別以不指定編碼、指定編碼爲utf-8、指定編碼爲utf-8-sig 三種方式來做比較,再將寫入csv 文件和txt 文件來做個對比一、不指定編碼方式 ...
- 3utf-8和utf-8-sig的区别 - 简书
前言:在写入csv文件中,出现了乱码的问题。 解决:utf-8改为utf-8-sig 区别如下: 1、”utf-8“ 是以字节为编码单元,它的字节顺序在所有系统中都是一样 ...
- 4Python如何利用utf-8-sig编码格式解决写入csv文件乱码问题
这篇文章主要介绍了Python如何利用utf-8-sig编码格式解决写入csv文件乱码问题,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章 ...
- 5问答- 腾讯云开发者社区-腾讯云
有没有一个解决方案可以接受任何已知的Python编码和输出为UTF-8而不需要BOM? ... fp = open('brh-m-157.json','rw') s = fp.read() u ...