Hi,
I m trying to read a text file and replace some text then save in all the content to another file. But the problem is Turkish characters seems like ?.
How can I fix it?
Thanks in advance.
Here is the content of output file:
B.?EH?R BLD - KAR?IYAKA 2011-01-11T13:30:00
Here is the code:
...
If File.Exists("d:\DRAWPROGRAM\Draw_Program_606_MOD@BIOS_LOCAL_TUR_OFL.txt") Then
System.IO.File.Delete("d:\DRAWPROGRAM\Draw_Program_606_MOD@BIOS_LOCAL_TUR_OFL.txt")
End If
Dim e1 As Encoding = Encoding.GetEncoding("ISO-8859-9")
'Pass the file path and the file name to the StreamWriter constructor.
objStreamWriter = New StreamWriter("d:\DRAWPROGRAM\Draw_Program_606_MOD@BIOS_LOCAL_TUR_OFL.txt", True, e1)
Dim lines() As String = Regex.Split(allRead, "\r?\n")
' Loop over the elements in the resulting array.
For Each item As String In lines
If Not String.IsNullOrEmpty(item) And Not String.IsNullOrWhiteSpace(item) Then
'If we have the Date (2011-03-27)
If item.Contains(m_request.Value) Then
Dim d As Integer = Nothing
Long.TryParse(m_request.Groups(2).Value, d)
d = d - 1
Dim replaced As String = Regex.Replace(item, "(2011-03-27T\d{2})", m_request.Groups(1).Value + d.ToString)
'Write a line of text.
objStreamWriter.WriteLine(replaced)
Else
'Write a line of text.
objStreamWriter.WriteLine(item)
End If
I m trying to read a text file and replace some text then save in all the content to another file. But the problem is Turkish characters seems like ?.
How can I fix it?
Thanks in advance.
Here is the content of output file:
B.?EH?R BLD - KAR?IYAKA 2011-01-11T13:30:00
Here is the code:
...
If File.Exists("d:\DRAWPROGRAM\Draw_Program_606_MOD@BIOS_LOCAL_TUR_OFL.txt") Then
System.IO.File.Delete("d:\DRAWPROGRAM\Draw_Program_606_MOD@BIOS_LOCAL_TUR_OFL.txt")
End If
Dim e1 As Encoding = Encoding.GetEncoding("ISO-8859-9")
'Pass the file path and the file name to the StreamWriter constructor.
objStreamWriter = New StreamWriter("d:\DRAWPROGRAM\Draw_Program_606_MOD@BIOS_LOCAL_TUR_OFL.txt", True, e1)
Dim lines() As String = Regex.Split(allRead, "\r?\n")
' Loop over the elements in the resulting array.
For Each item As String In lines
If Not String.IsNullOrEmpty(item) And Not String.IsNullOrWhiteSpace(item) Then
'If we have the Date (2011-03-27)
If item.Contains(m_request.Value) Then
Dim d As Integer = Nothing
Long.TryParse(m_request.Groups(2).Value, d)
d = d - 1
Dim replaced As String = Regex.Replace(item, "(2011-03-27T\d{2})", m_request.Groups(1).Value + d.ToString)
'Write a line of text.
objStreamWriter.WriteLine(replaced)
Else
'Write a line of text.
objStreamWriter.WriteLine(item)
End If