How to convert multiple files encoded in UTF-8-BOM to ANSI?
文章推薦指數: 80 %
I would like the output to be correct in both cases. If Powershell it's not the solution, what else do you guys recommend ? powershell ... SuperUserisaquestionandanswersiteforcomputerenthusiastsandpowerusers.Itonlytakesaminutetosignup. Signuptojointhiscommunity Anybodycanaskaquestion Anybodycananswer Thebestanswersarevotedupandrisetothetop Home Public Questions Tags Users Companies Unanswered Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. LearnmoreaboutTeams HowtoconvertmultiplefilesencodedinUTF-8-BOMtoANSI? AskQuestion Asked 1year,7monthsago Modified 1year,7monthsago Viewed 2ktimes -1 I'mtryingtoconvertmultiplefilesthatareencodedinUTF-8-BOMbacktoANSI. IfoundoutthatwithPowershellusingthiscommand: PS>get-itemc:\temp\utf8\*.*|foreach-object{get-content-Encodingutf8BOM$_|out-file("c:\temp\ansi\"+$_.Name)-encodingdefault} Itisworking,buttheproblemisthatitdoesnotsupportISO-8859-2. Characterslikeăorâaredisplayedcorrectly,butcharacterslikeţorşaredisplayedasquestionsmarks. Iwouldliketheoutputtobecorrectinbothcases. IfPowershellit'snotthesolution,whatelsedoyouguysrecommend? powershellencodingunicodeansi Share Improvethisquestion Follow editedMar1,2021at18:13 PatrickMevzek 1,53244goldbadges1515silverbadges2222bronzebadges askedFeb28,2021at20:53 zickzick 111bronzebadge 1 1 DidyoutellittouseISO-8859-2ordoyouexpectittoguessforeveryfile? – user1686 Feb28,2021at21:27 Addacomment | 1Answer 1 Sortedby: Resettodefault Highestscore(default) Datemodified(newestfirst) Datecreated(oldestfirst) 0 IfyouhavealetterthatisencodedinUTF-8-BOMbutisnotincludedinANSI,theconversionwillfail. AreyouawarethatANSIcodesfitintoonebytewhereUTF-8canuseuptofourbytes? 1.3.20210:11MEZ: YourconversionfromUTF-8toANSIcanonlyworkifthelettersinUTF8usedarepartofANSI. Lookhere:"Neutralchessking" https://www.utf8-zeichentabelle.de/unicode-utf8-table.pl ThereisnoANSIcodeforthisUTFletter. Share Improvethisanswer Follow editedFeb28,2021at23:16 answeredFeb28,2021at22:54 r2d3r2d3 2,27211goldbadge66silverbadges1818bronzebadges 1 IknowasoftwarethatisabletoencodeUTF-8-BOMtoANSIandsaveallthecharacterswithnoissues,butislackingbatchmode.Ididin'tknowwhatyousaidaboutANSIcodes,IonlyknowthatoneparticularsoftwareisabletochangeandIwaslookingforsomethingtoworkfasterwith. – zick Feb28,2021at23:06 Addacomment | YourAnswer ThanksforcontributingananswertoSuperUser!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?Browseotherquestionstaggedpowershellencodingunicodeansioraskyourownquestion. TheOverflowBlog HowtoearnamillionreputationonStackOverflow:beofservicetoothers Therightwaytojobhop(Ep.495) FeaturedonMeta BookmarkshaveevolvedintoSaves Inboximprovements:markingnotificationsasread/unread,andafiltered... Related 13 FixencodingofGermanumlautsindirectoriesandfilenames(ü=u╠êandsoon) 2 ConvertANSItextfile(s)toUTF8onWindowscommandline 2 Subtitleencodingissuewithmkvtoolnix 33 ANSItoUTF-8inNotepad++ 6 WhydotexteditorsthinkthisfileisUTF-8? 19 HyphenisnotrenderinginNotepad++ 2 HowcanIperformanISO-8859-1toUTF-8textfileconversionwhilenotchanginganycharactersthatarealreadyvalidUTF-8 HotNetworkQuestions IsdocumentingabigprojectwithUMLDiagramsneeded,goodtohaveorevennotpossible? DotheseresultsmeanthatIhavefoundthisexoplanet? HowradioactivecouldImakesomematerials,whilekeepingthem"cold"? Whyarefighterjetssoloudwhendoingslowflight? WhatisthedifferencebetweenGlidepathversusGlideslope? WhydopeopleinsistonusingTikzwhentheycanusesimplerdrawingtools? Probabilisticmethodsforundecidableproblem Traditionally,andcurrently,whatstopshumanvotecountersfromalteringballotstomakethem'Spoilt/Invalidvotes? 9dotsthatare3by3,continuethepattern CanIuseaspritesheetfromanexistingvideogameformypromotionalreel? FPGAlogicthreshold-distinguishingalogic0and1 StrangeFruitfromTomatoPlant LaTeX2(e)vsLaTeX3 HowdoIdownloadmacOSMontereyonunsupportedMac? DidMS-DOSeverdropabilitytosupportnon-IBMPCcompatiblemachines? What'sthedifferencebetween'Dynamic','Random',and'Procedural'generations? Determinethelengthoftherestofamathdisplaylineformultlined Ifquasarsdestroyalllifeintheirhostgalaxy,thenhowdidlifesurvivewhenMilkyWaywasaQuasar6millionyearsago? MLmodellingwheretheoutputaffectstheDGP Whyare"eat"and"drink"differentwordsinlanguages? Idon'tunderstandif"per"meaningexactamountforeachunitordoesitmean"onaverage" Myfavoriteanimalisa-singularandpluralform Canaphotonturnaprotonintoaneutron? WhydidGodprohibitwearingofgarmentsofdifferentmaterialsinLeviticus19:19? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. default Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1How to convert multiple files encoded in UTF-8-BOM to ANSI?
I would like the output to be correct in both cases. If Powershell it's not the solution, what el...
- 2Set-Content - PowerShell - SS64.com
Write or replace the content in an item. This will overwrite any pre-existing content. ... Under ...
- 3How to specify encoding when creating Powershell text file ...
I'm having an issue where the file is saved with encoding type Unicode - whereas I want the file ...
- 4convert txt utf-8 to ansi - PowerShell - Spiceworks Community
I have a system generation csv files but as UTF-8. I want a way to automatically convert the file...
- 5How to save command output to file using Command Prompt or ...