流 Reader 不读取上标字符
Stream Reader not Reading SuperScript characters
我正在使用 StreamReader 将数据从 Tab Delim 文本文件导入到名为导入数据的数据 Table。由于某些原因,none 的 superScript 字符在导入到 table.
后是可读的
例如,如果我在文本文件中有一个 ProductName 值 "Universal 360° Rotating Finger Ring Holder",导入后该值会变成 "Universal 360� Rotating Finger Ring Holder" 它与其他字符相同,例如“ ® , ™ ”。
我的代码有问题吗?
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)
应该能够正确阅读。
我正在使用 StreamReader 将数据从 Tab Delim 文本文件导入到名为导入数据的数据 Table。由于某些原因,none 的 superScript 字符在导入到 table.
后是可读的例如,如果我在文本文件中有一个 ProductName 值 "Universal 360° Rotating Finger Ring Holder",导入后该值会变成 "Universal 360� Rotating Finger Ring Holder" 它与其他字符相同,例如“ ® , ™ ”。
我的代码有问题吗?
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)
应该能够正确阅读。