|
| I have a custom preprocessor for Biztalk 2002, which process some EDI
file(ANSI encoding), but after process (as expected), the out put file is
encoded as unicode instead of ANSI, no matter how I set nCodePageOut =
nCodePageIn
or 'System.Text.Encoding.Default.CodePage 'temp.CodePage
'1252
The result is alway's the same unicode, when I apply the preprocessor to
File Receive function, and point to FileSend of FTP channel/port. My VB.NET
code is like below, please help. Thanks.
Public Sub Execute(ByVal vDataIn As Object, ByVal nCodePageIn As
Integer, ByVal bIsFilePath As Boolean, ByRef nCodePageOut As Object, ByRef
vDataOut As Object) Implements BTSComponentsLib.IBTSCustomProcess.Execute
nCodePageOut = nCodePageIn
If Not bIsFilePath Then Return
Try
Dim txtDoc As String = ""
Dim fs As FileStream = File.Open(vDataIn, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite)
Dim b(1024) As Byte
Dim x As Integer
Dim temp As System.Text.Encoding ' Text.UTF8Encoding
temp = System.Text.Encoding.GetEncoding(1252)
'Text.Encoding.Default
x = fs.Read(b, 0, b.Length)
Do While x > 0
txtDoc &= Left(temp.GetString(b), x)
x = fs.Read(b, 0, b.Length)
Loop
fs.Close()
txtDoc = Replace(txtDoc, "~", "~" & vbCrLf)
vDataOut = txtDoc
nCodePageOut = nCodePageIn
'System.Text.Encoding.Default.CodePage 'temp.CodePage
'1252
Catch Ex As Exception
Console.WriteLine(Ex.Message)
Throw New Exception(Ex.Message, Ex)
End Try
End Sub
|
|