How to delete BOM from a string? - MSDN
文章推薦指數: 80 %
Microsoft Logo. Gray Pipe ... How I can delete the BOM? Picture 1 and 2. bom1 bom 2 ... Remove(0, BOMMarkUtf8.Length); return p.
We’resorry.Thecontentyourequestedhasbeenremoved.You’llbeautoredirectedin1second.
ThisforumhasmigratedtoMicrosoftQ&A.VisitMicrosoftQ&Atopostnewquestions.
LearnMore
Askaquestion
Quickaccess
Forumshome
Browseforumsusers
FAQ
Searchrelatedthreads
RemoveFromMyForums
Answeredby:
HowtodeleteBOMfromastring?
ArchivedForums421-440
>
VisualC#
Question
0
Signintovote
Hello,
HowIcandeletetheBOM?
Picture1and2
Thanksfortips.
GreetingsMarkus
privatestaticstringRemoveBom(stringp)
{
stringBOMMarkUtf8=Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
if(p.StartsWith(BOMMarkUtf8,StringComparison.OrdinalIgnoreCase))
p=p.Remove(0,BOMMarkUtf8.Length);
returnp.Replace("\0","");
}
privateasyncvoidFileReadOrTimeout(objectsender,RoutedEventArgse)
{
try
{
varret=awaitReadDataAsync(@"C:\Users\Freitag\Documents\TEST_M_3.xml",2000);
stringconverted=Encoding.UTF8.GetString(ret,0,ret.Length);
converted=RemoveBom(converted);
MessageBox.Show(converted+"\n\nEnd");
}
}
privateasyncTask
延伸文章資訊
- 1How to delete BOM from a string? - MSDN
Microsoft Logo. Gray Pipe ... How I can delete the BOM? Picture 1 and 2. bom1 bom 2 ... Remove(0,...
- 2Vscode remove bom - 軟體兄弟
Vscode remove bom,bpasero added file-explorer and removed feature-request labels ... default retu...
- 3How can I remove the BOM from a UTF-8 file?
- 4remove bom from utf-8 files - gists · GitHub
remove bom from utf-8 files. GitHub Gist: instantly share code, notes, and snippets.
- 5How to remove BOM from any text/XML file - IBM
1. Download Notepad++. · 2. To check if BOM character exists, open the file in Notepad++ and look...