I've just uploaded an updated version of my FixEncoding custom pipeline component for BizTalk 2006 (an update for the BizTalk 2004 version is in the works); you can download it from here.

This update is about making the component useful in Send pipelines. The original version only set the Charset property of the Body part of the message, which is used by the Xml and Flat File disassemblers as one possible way to infer the encoding of an incoming message when probing and disassembling it, and that works fine.

However, send pipelines work in a different way: Both the Flat File and Xml Assembler components will ignore the Body Part's Charset property value, and instead will use the encoding specified in the component properties. The problem with this is that the list of encodings to choose from in the Pipeline Designer for both components is severely limited, even though the underlying .NET encoding facilities (which in turn are partially based on the built-in Operating System facilities) support quite a bit more.

My FixEncoding component, however, didn't have that issue and would allow you to choose any encoding supported by .NET and the Operating System with no problem. However, since it only sets the Body Part's Charset property, trying to use it in a send pipeline wasn't very useful.

Both the Flat File and Xml Assembler components do support another way of selecting the desired component: using the XMLNorm.TargetCharset context property of the message being sent. You can usually set this directly from an orchestration when creating the message, but this is inconvinient, and not very reusable. Besides, this really is the kind of thing that is much cleanly done at the pipeline level.

This updated version of the FixEncoding component now contains a second pipeline component: The SetEncodingComponent. It works just like the FixEncoding component except that it's for use in Send Pipelines and it writes the XMLNorm.TargetCharset property to the message context. You should use it in the Pre-Assemble stage of any send pipeline, and remember to set the TargetCharset of any assembler component to "(None)" so it doesn't override the encoding you choose on the SetEncoding component

Hope you find it useful!


Tomas Restrepo

Software developer located in Colombia.