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 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...
- 2How 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,...
- 3BOM: 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 ...
- 4Batch script remove BOM () from file - Stack Overflow
This is because the type command will preserve the UTF-8 BOM, so when you combine multiple files ...
- 5remove bom from utf-8 files - gists · GitHub
remove bom from utf-8 files. GitHub Gist: instantly share code, notes, and snippets.