Windows Server - Flat File Assembler Encoding Problem

Asked By F.Mondelo - http://felixmondelo.blogspot.com/
17-Jan-08 02:52 AM
Hi, I'm trying to assemble a flat file with target charset iso-8859-1.
I use XMLNorm.TargetCharset message context property for that.

The target file encoding is right, but spanish characters (N tilde, U
umlaut, ...) is represented with question marks (3F in hexadecimal).

Anyone has a solution for this issue?
System.Text.Encoding.Convert
(1)
XMLNorm.TargetCharset
(1)
System.IO.Stream
(1)
IPipelineContext
(1)
IBaseMessage
(1)
DestBuffer.Length
(1)
TargetCharsetfrom
(1)
TargetCharset
(1)
  Tomas Restrepo [MVP] replied...
14-Jan-08 02:05 PM
Hi Felix,

Are you sure the problem is in the output file, and not that the characters
got corrupted during input from another source?

Also, what happens if you try other encodings (like one of the unicode
ones)? Do they appear correctly?


--
Tomas Restrepo
http://www.devdeo.com/
http://www.winterdom.com/weblog/
  F.Mondelo - http://felixmondelo.blogspot.com/ replied...
17-Jan-08 02:52 AM
I have a solution that works for now, but is not using TargetCharset
from flat file assembler. I have done a custom pipeline component that
calls flat file assembler and then converts the result into
iso-8859-1:

protected override IBaseMessage Assemble(IPipelineContext pc)
{
IBaseMessage retMsg = _assembler.Assemble(pc);
System.Text.Encoding encoder =
System.Text.Encoding.GetEncoding("iso-8859-1");

byte[] buffer = new byte[1024];
byte[] destBuffer = new byte [1024];
System.IO.Stream strm = retMsg.BodyPart.Data;
VirtualStream vStrm = new VirtualStream();

while (strm.Read(buffer, 0, 1024) > 0)
{
destBuffer = System.Text.Encoding.Convert
(Encoding.UTF8, encoder, buffer);
vStrm.Write(destBuffer, 0, destBuffer.Length);
}

retMsg.BodyPart.Data = vStrm;
retMsg.BodyPart.Data.Position = 0;

return retMsg;
}

This works, I mean, after flat file assembler the output file is
correct in utf-8 (for example, N tilde is represented by bytes C3 91)
and then I can convert it to iso-8859-1 (N tilde is converted from C3
91 to D1), but if I use directly XMLNORM.TargetCharset = "iso-8859-1",
after assembler I get spanish characters as question marks (byte 3F).

I think the problem is with assembler encoding, because without set
any charset (utf-8 by default) it works correctly.
Create New Account
help
Conversion from system.io.stream to java.io.inputstream Windows Server Hi, Can anyone tell me how to convert the want to convert from C# to J#? - - Now you''''''''re BizTalk''''''''in keywords: Conversion, from, system.io.stream, to, java.io.inputstream description: Hi, Can anyone tell me how to convert the input
How to use XMLNorm.TargetCharset in BizTalk Windows Server Hi. I need to use the XMLNorm.TargetCharset in a MessageAssignment-shape in an orchestration. But when I try the following (where "xml_encoding" is a message type in my orchestration): xml_encoding(XMLNorm.TargetCharset) = "UTF-16"; I get the following error: are you missing an assembly reference ?" Anybody who do next ? (I'm pretty new in BizTalk-programming.) BizTalk Discussions Microsoft.BizTalk.GlobalPropertySchemas (1) XMLNorm.TargetCharset (1) BizTalk (1) MessageAssignment (1) XMLNORM (1) Efakbbs (1) Exisst (1) Gorm (1) On Thu
XLANGPipelineManagerException: The pipeline manager could not prepare the message(s) for processing pipeline Error Details: "System.IO.Stream" - --> System.InvalidCastException: System.IO.Stream at Microsoft.XLANGs.Core.CustomFormattedPart.ProtectedRetrieveAs(Type t) at Microsoft.XLANGs.Core.Part.RetrieveAs(Type XLangMessage before executing the pipeline. In this process, the engine is retrieving the parts as System.IO.Stream. You can find the code under Microsoft.XLANGs.Pipeline.PipelineXPart of assembly Microsoft.XLANGs