BizTalk Server General - 2002 custom preprocessor output encoding

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > January 2005 > 2002 custom preprocessor output encoding





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author 2002 custom preprocessor output encoding
Tony

2005-01-31, 5:53 pm

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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com