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
延伸文章資訊
- 1[PHP] 無痛遠離UTF-8 BOM - 工程的日子每天都很師
會有這樣的問題發生,是因為網站專案中有使用到UTF8 含BOM 編碼的檔案,那 ... <?php //remove the utf-8 boms //by magicbug at gmail ...
- 2Vscode remove bom - 軟體兄弟
Vscode remove bom,bpasero added file-explorer and removed feature-request labels ... default retu...
- 3How 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,...
- 4BOM: What is a Byte Order Mark? - IONOS
If you want to remove the byte order mark from a source code, you need a text editor that offers ...
- 5How can I remove the BOM from a UTF-8 file?