|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Importing Text File With Diacritical MarksWhen a line from a flat text file is imported from a file using the StreamReader, any character that has a Diacritical Mark is dropped. Sample Code: Dim fs As FileStream Dim sr As StreamReader Try fs = New FileStream("c:\temp\badrecords.txt", FileMode.Open, FileAccess.Read) sr = New StreamReader(fs) Dim line As String = sr.ReadLine() Do While Not line Is Nothing Debug.WriteLine(line.ToCharArray()) line = sr.ReadLine() Loop MessageBox.Show("Done") Catch ex As Exception MessageBox.Show(ex.Message) Err.Clear() Finally If Not sr Is Nothing Then sr.Close() sr = Nothing End If If Not fs Is Nothing Then fs.Close() fs = Nothing End If End Try Hello BostonNole,
Figure out what encoding scheme you are using (most likely UTF-8 or Unicode). Then use the appropriate encoding when reading the file (your stream reader will include and overloaded ctor which accepts an Encoding parameter). -Boo Show quoteHide quote > Refer to MS article Q98999 for an explanation of Diacritical Marks. > > When a line from a flat text file is imported from a file using the > StreamReader, any character that has a Diacritical Mark is dropped. > > Sample Code: > Dim fs As FileStream > Dim sr As StreamReader > Try > fs = New FileStream("c:\temp\badrecords.txt", > FileMode.Open, FileAccess.Read) > sr = New StreamReader(fs) > Dim line As String = sr.ReadLine() > Do While Not line Is Nothing > Debug.WriteLine(line.ToCharArray()) > > line = sr.ReadLine() > > Loop > > MessageBox.Show("Done") > > Catch ex As Exception > MessageBox.Show(ex.Message) > Err.Clear() > Finally > If Not sr Is Nothing Then > sr.Close() > sr = Nothing > End If > If Not fs Is Nothing Then > fs.Close() > fs = Nothing > End If > End Try >
Oracle read only transaction in VB .NET?
Compress a string "Array" of pictureboxes Concurrency question Security Exception when deploying a VB.NET 2003 solution. making a string var like "nr1 nr2 nr3" retrieve key from collection Help me, please view the strange problem!!! windows Registry parameter "any" VB 6 (what is your equivalent in vb 2005 ?) |
|||||||||||||||||||||||