logo

Hi Felix,Are you sure the problem is in the output file, and not that the

Tomas Restrepo [MVP] posted on Monday, January 14, 2008 2: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/
reply


Flat File Assembler Encoding Problem

F.Mondelo - http://felixmondelo.blogspot.com/ posted on Thursday, January 17, 2008 2: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?
reply

I have a solution that works for now, but is not using TargetCharsetfrom flat

F.Mondelo - http://felixmondelo.blogspot.com/ posted on Thursday, January 17, 2008 2: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.
reply

 

Didn't Find The Answer You Were Looking For?

View BizTalk Posts   Ask A New Question

EggHeadCafe has experts online right now that may know the answer to your question.  We pay them a bonus for answering as many questions as they can.  So, why not help them and yourself by becoming a member (free) and ask them your question right now?
Ask Question In Live Forum

If you have an OpenID and do not want to become a member of the EggHeadCafe forum, you can also sign on to Chat Chaos and post your question to our real time Silverlight chat application.
Ask Question In Chat Chaos


BizTalk    BizTalk Orchestration   






  $1000 Contest    [)ia6l0 iii - $231  |  Jonathan VH - $153  |  Huggy Bear - $133  |  egg egg - $100  |  F Cali - $93  |  more Advertise  |  Privacy  |   (c) 2010