我正在使用StreamReader将Tab Delim Text文件中的数据导入名为Import Data的数据表。由于某些原因,一旦导入到表中,所有superScript字符都不可读。
例如,如果我在文本文件中有一个ProductName值“Universal 360°Rotating Finger Ring Holder”,则导入后该值将变为“Universal360 旋转指环”,与“®,™”等其他字符相同。
我的代码有什么关系吗?
Public Function FillData(ByVal Fpath As String) As Boolean
Dim XRead As System.IO.StreamReader = New IO.StreamReader(FilePath)
Dim XLine As String = Nothing
Dim XSplitLine() As String
Dim i As Integer = ImportedData.Rows.Count + 1
Try
XRead.ReadLine()
XLine = XRead.ReadLine()
Do Until XLine Is Nothing
XLine = i & vbTab & XLine & vbTab & FilePath
XSplitLine = XLine.Split(CType(vbTab, Char()))
ImportedData.Rows.Add(XSplitLine)
XLine = XRead.ReadLine
i += 1
Loop
XRead.Close()
Catch ex As Exception
MessageBox.Show("Error")
Return False
Exit Function
End Try
Return True
End Function
Dim XRead As System.IO.StreamReader = New IO.StreamReader(FilePath,Text.encoding.DefaultEncoding)
应该能够正确阅读。