2
您好,大家下午好,我是在我的项目长话短说的发展我需要保存我的HTML基本页面使用UTF8或Unicode保存vb.net HTML在UTF8或Unicode
Dim y As String
Dim UTF8encoding() As Byte, MyEncoder As New System.Text.UTF8Encoding(TRUE)
y = (html code should be here will be under)
Dim utf8 As New UTF8Encoding()
Dim utf8EmitBOM As New UTF8Encoding(True)
Dim code As String = y
Path = "C:\Users\OWNER\Desktop\invoice.html"
Try
Dim my_write As System.IO.StreamWriter
my_write = IO.File.CreateText(path)
my_write.write(utf8EmitBOM.GetPreamble())
UTF8encoding = System.Text.Encoding.Convert(System.Text.Encoding.UTF8, System.Text.Encoding.Unicode, MyEncoder.GetBytes(y))
my_write.WriteLine(code)
my_write.Close()
Catch ex As Exception
End Try
HTML
<html>
<style>
table, th, td
{ border: 1px solid black; }
</style>
</head>
<body><center><b>
<font size=20>Family Butcher</font></br></br></br><center><b>
<font size =4>164 Battersea Bridge Road London SW11 3AW</center></font><center><b>
<font size =4>Tel: Mob:</center></font><center><b>
<font size =4>VAT No: 835522334</center></br></font></br>
<table Border = 3 WIDTH=610 align=left></br><tr>
<th colspan=3 align = left>To: " & txto & " <br/>
<br/>Date: <br/><br/>Invoice nº <br/></th></tr>
<td WIDTH = 100 HEIGHT=40><center><b>Quantity </b></td>
<td WIDTH = 400><center><b>Description</b></td><td><center>
<b>Value</b> </br></p>
</body></html>
我一时不知道如何保存在Unicode或UTF8的文件,然后我无法打开无符号“A”谢谢你的HTML文件的任何支持
你试过File.WriteAllText? https://msdn.microsoft.com/en-us/library/ms143376(v=vs.110).aspx – Neolisk
@neolist我爱你... T_T,基本上我错过阅读和应用文件写所有,谢谢你好哟 –
我很乐意提供帮助。请接受我的答案。 – Neolisk