I have an application which converts ASCII encoded file to EBCDIC encoded file. My problem is that, whenever I try to use other conversion tool(EBCDIC to ASCII), I am having a problem.
This is where I got my codes http://support.microsoft.com/kb/216399
CS?NTPRC?37-MAY MTLAW 4RY? - This should be the result looks like.
CcCs@@CnCtCp$$CrCc@@C?C?-CmCaCy CmCtClCaCw C?$$CrCy@@CmCtClCaCw$$ - This content of my file.
Don't use that code, dealing with different encodings is very well supported in .NET:
Imports System.IO
Imports System.Text
Module Conversions
Public Sub ConvertAsciiToEbcdic(ByVal inpath As String, ByVal outpath As String)
Using sr As New StreamReader(inpath, Encoding.ASCII)
Using sw As New StreamWriter(outpath, False, Encoding.GetEncoding(37))
Do
Dim line = sr.ReadLine()
If line Is Nothing Then Exit Do
sw.WriteLine(line)
Loop
End Using
End Using
End Sub
End Module
Just swap the Encodings if you want to convert the opposite way.