BOM: What is a Byte Order Mark? - IONOS

文章推薦指數: 80 %
投票人數:10人

If you want to remove the byte order mark from a source code, you need a text editor that offers the option of saving the mark. You read the ... IONOS DigitalGuide Websites Webdevelopment ByteOrderMark 09.01.20Webdevelopment Informationsentovertheinternetneedstobeinacertainorder.Thedatarecipient(forexample,aHTMLpage)needstoknowhowtoreadtheinformation.Toensurethis,differentmarkersareputinthecode.Onesuchmarkeristhebyteordermark(BOM).Butwhatisthemarkerintendedfor?ContentsWhyDoYouNeedtheBOM?IssueswithByteOrderMarkHowtoremoveBOMWhyDoYouNeedtheBOM?Characterscanbecodedinvariousways.Whiletoday,UTF-8isusedalot,UTF-16encodingwaspreviouslypopular–andisstilloftenusedtoday.UTF-32isalsousedsometimes.UnlikewithUTF-8,however,encodingwithalargernumberofbitspercharacterrequirestheorderofbytestobeknown.WithUTF-8encoding,eachcharactercanbepresentedwithinonebyte(i.e.8bits).WithUTF-16ontheotherhand,youneedtwobytes(so16bits)toencodeacharacter.Inorderforthecharactertobeinterpretedcorrectly,itmustbeclearwhetherthebytesarereadfromlefttorightorfromrighttoleft.Dependingonthis,acompletelydifferentvalueiscreated.Fromlefttoright:0110101000110101is6a35inhexadecimalnotationFromrighttoleft:0110101000110101is356ainhexadecimalnotationWhenlookingatthisnumbersequenceinthecontextofaUnicodetable,twocompletelydifferentcharacterswouldbedisplayed.ThefirstformofinterpretationisknownasBigEndian(BE),andthesecondasLittleEndian(LE).ThereasonforthisisthatwithBigEndian,thehighervalueisindicatedfirst,andwithLittleEndian,thelowervalueisindicatedfirst.FactIneverydaylife,theBigEndiannotationismorefrequentlyused.Butthisisjustaconvention.Computerscanhandlebothmethodsofstorage,soitmakessensetomarkthem.Inordertoindicatetheorderinwhichthebytesaretoberead,youneedaBOM.Thisisacharacterthatisnotvisibleandthereforealsoknownasazero-widthno-breakspace.It’saspacethathasawidthofzeroanddoesnottriggeralinebreak.InUTF-16,thischaracter(hexadecimal)iseitherfeff(BE)orfffe(LE).Thisvalueisthenprefixedtotheactualcharacterencoding.UTF-8doesn’tactuallyneedtheBOM–andyetitisalsofoundintextsencodedwithit.ThisiseitheraremnantthataroseintheconversionfromUTF-16/UTF-32toUTF-8,orithasbeenautomaticallyinsertedbyaneditor.Thisisbecause,evenifthebyteordermarkisnotnecessaryforUTF-8,itusuallydoesnotgetinthewaysinceitisnotdisplayed.IssueswithByteOrderMarkProblemsarisewhenthereceivingsystemdoesnotknowhowtohandletheBOM.SomePHPversionsorvariousUnix-likeenvironmentsdonotexpectthecharacter,whichcanleadtoanincorrectpresentationofawebsite,forexample.ProblemscanalsoarisebetweenHTTPandHTML:OneHTTPheaderalreadycontainsinformationaboutcharacterencoding.Thiscomesfromtheserversettings.IftheHTMLdocumenthasbeencreatedwithaBOM,buttheHTTPheadermakesadifferentindicationtothebrowser,thiscanalsoleadtodisplayerrors.ThisshouldnolongeroccursincethechangeintheHTML5specificationtookplace:There,itwasrequiredthattheBOMoverwritestheinformationoftheHTTPheaderatthebeginning.However,it’spossiblethatolderbrowserversionshavenotyetimplementedthisnewrule.HowtoremoveBOMIfyouwanttoremovethebyteordermarkfromasourcecode,youneedatexteditorthatofferstheoptionofsavingthemark.YoureadthefilewiththeBOMintothesoftware,thensaveitagainwithouttheBOMandtherebyconvertthecoding.Themarkshouldthennolongerappear.InthepopulartexteditorNotepad++,forexample,youcanchangetheencodingandthensavethefilewithouttheBOM.WithatexteditorlikeNotepad++,youcanremovetheBOMbyconvertingthefile.NoteInolderversionsofNotepad++,youcanstillfindthemenuentryUTF-8withoutaBOM.Innewerversions,thiscorrespondstoUTF-8.Withthemarker,theentrywouldcorrespondtoUTF-8BOM.09.01.20WebdevelopmentRelatedarticles CSScompressionforconsistentloadingtimes 18.07.2019Webdesign It’sraretoseecreativeinformationdirectlyplacedintoHTMLcode.Colours,fonts,andsizesofHTMLelementsarenormallydefinedinstylesheets,suchasCSS.Themorecomplexawebsitebecomes,themoretherangeandamountofrequiredCSSfilesincrease.Theextraburdencanhaveaconsiderableeffectonyourwebsite’sloadingtime,butthiscanbeavoidedbycompressingyourCSS. CSScompressionforconsistentloadingtimes LearnHTML:thefirststepswiththestandardweblanguage 15.11.2019Webdevelopment Intimesofcontentmanagementsystemsandwebsiteconstructionkits,youmightthinkit’sawasteoftimelearningHTML.Butifapagedoesn’tworkforsomereasonorifyouplantoinstalldynamicelements,youwon’tbeabletocontinuewithouthavingknowledgeofthisweblanguage.InourdetailedHTMLtutorial,weintroduceyoutothebasicfeaturesofthemarkuplanguage,includingnumerous... LearnHTML:thefirststepswiththestandardweblanguage LessCSS:Introductionandtutorial 07.02.2020Webdevelopment CSSisoneofthemostimportantlanguagesintheWorldWideWeb.Butworkingwiththestylesheetlanguageisoftenunnecessarilycomplicated,whichiswhymanydevelopersprefertouseLessinstead.TheCSSpreprocessornotonlymakeswritingstylesheetcodeeasier,italsoexpandsCSSwitharangeoffeaturesincludingvariables,functions,andmixins.OurLesstutorialexplainshowitworks. LessCSS:Introductionandtutorial BLOBs(BinaryLargeObjects):introduction 16.03.2020Webdevelopment BLOBisshortforBinaryLargeObject.ThedatatypesinaBLOBaretypicallyclassifiedasbeingunstructureddata.Atypicalexampleofanunstructureddatatypeismultimediafiles,whichareusuallystoredindatabasesasaBLOB.SincedatabasescannotreadtheunstructureddatainBLOBs,specialdataprocessingmethodsarerequired. BLOBs(BinaryLargeObjects):introduction Protobuf:StructuredCodewithProtocolBuffers 23.06.2020Webdevelopment ThetransmissionofdataincomputernetworkssuchastheInternetorbetweentwoapplicationsisinfluencedbyvariousfactors.Thesetransmissionsfocusonperformanceandsecurity.ProtocolBuffers,developedbyGoogle,impressesinbothareasandprovestobeaworthwhilealternativetoclassic,text-baseddataexchangeformatssuchasJSONorXML. Protobuf:StructuredCodewithProtocolBuffersRelatedProductsMyWebsiteSeepackagesWebhostingforagenciesProvidepowerfulandreliableservicetoyourclientswithawebhostingpackagefromIONOSViewpackages PopularArticles AddingGoogleAnalyticstoWordPressHere,you’llfindouthowyoucanlinkGoogleAnalyticstoawebsitewhilealsoensuringdataprotection...CreatingawebsitewithWordPress:ABeginner’sGuideOurWordPressguidewillguideyoustep-by-stepthroughthewebsitemakingprocess...WordPressblogthemesSpecialWordPressblogthemesletyoucreateinterestingandvisuallystunningonlinelogs...InstructionsfordisablingWordPresscommentsYoucanturnoffcommentsforindividualpagesorpostsorforyourentirewebsite.Keepreadingtofindouthow...WordPress:AMPPluginsWewillshowyouthebestAMPpluginsforWordPressataglance... Yourdigitalpartner Webupgrades?Relax...Iownthis! Findtherightdomain,buildawebsiteorscaleupinthecloud. Startnow From£1/month Websitebuilder From£1/month Domain Tryforfree Cloudsolutions



請為這篇文章評分?