Some special characters are added in the BizTalk output file - biztalk

I have put an XML into a receive location using the Microsoft BizTalk default pipeline "XMLReceive" and then use PassThroughTransmit to output the file to a directory.
However, if hex editor to check the output file, I found that there are three special characters  are found at the beginning of the output file.
The ASCII of  is EF BB BF.
Is there any idea why there are 3 control characters are added at the beginning of the output file?

Those characters are the Byte Order Mark which tell the receiving application how to interpret the text stream. They are not junk but are optional.
I recommend you always send the BOM unless the recieving system cannot accept them (which is really their problem ;).

I have googled the solution myself and shared to others.
Removing the BOM from Outgoing BizTalk Files
http://mindovermessaging.com/2013/08/06/removing-the-bom-from-outgoing-biztalk-files/
The three special characters are BOM (Byte Order Mark), set the PreserveBOM to false in sendport XMLTransmit pipeline will remove these three characters.

Related

Editing .bin (binary) (hex) file in Powerbuilder 12

I have an app where I allow the user to enter data and then I'd like to open a .bin file, search for a particular position and then paste the data the user entered into the file.
Not sure how to go about doing this, looked over all of the FileOpen, FileRead, FileWriteEx but can't come up with a solution. What I'm doing now is opening up the file in a Hex Editor, searching for a particular string and then pasting the text. Doing this all manually, would like to figure out a way to do it automatically.
Is this possible in PB? What I'm pasting into the .bin file is actual text.
Below is an example....opening up in Hex editor and searching for 'Test...', once I find it then I skip 3 positions and paste my text.
[1] https://i.stack.imgur.com/RsVxS.png
Result after PB pastes text into .bin file
You probably want to create a dll in .Net which communicates with PB via COM. The dll would handle the Hex editing of the file after the PB application sends it the string entered by the user.
You need to convert the hex codes the user inputs to integers, then use the char function to convert them to characters. It's those characters you need to write to the file.

HL7 to SQLite with Mirth Connect

I'm trying to build a channel to read an HL7 ADT text file, extract an MRN and write output to a SQLite table (Database Writer).
My SQLite table contains my data but all my PatientIDs are appearing as a concatenated string in one very wide column. As opposed to a PatientID per row/record.
I'm noticing some weird illegal(?) characters in my HL7 file (which come from a Meditech EMR). In QuickViewHL7 they appear in the MSH-22 and MSH-30.
In the VIM editor -
My question is, are these supposed to be delimiters? If so, what are they? Carriage Returns?
I've posted this question on the Mirth Connect forums but seen little but tumbleweeds. I'm hoping someone here might have seen this before and tell me what's going on.
UPDATE: Hex dump suggests it's a 0x7f (0111 1111). This looks like a backspace character. Should I simply strip it or substitute it with something?
This illegal character should be a line feed carriage return to delimit the start of the next HL7 segment.
Using VIM, highlight the illegal character and press 'ga'. This will tell you the hex value of the character. In my case 0xfa (which appears to be a back space!?).
Again in Vim, do a global substitute for a \r
:%s/\%x7f/\r/g
Then save the file.
Everything parses out nicely now.

Handling multiple line-ending in an asp.net

When writing a web application which allows the upload of files, one must be concious of the fact that users of said web application may be on any operating system, including unix-like systems which use <lf> for line ending, mac-like systems which use <cr> for line endings, and windows-like systems which use <cr><lf> for line ending.
Assuming that I want to parse uploaded files (such as csv's) to access the data within them (for instance so as to import it into my application), is there a standard OS-agnostic method of breaking the file up into its constituent lines for further parsing?
You could use a StreamReader. The ReadLine method handles the various types of line break:
A line is defined as a sequence of characters followed by a line feed
("\n"), a carriage return ("\r"), or a carriage return immediately
followed by a line feed ("\r\n"). The string that is returned does not
contain the terminating carriage return or line feed.

HTML Entity in CSVs

How do I add an html entity to my CSV?
I have an asp.net, sql server that generates html, excel, and csv files. Some of the data needs to have the ‡ entity in it. How do I get it to output to my CSV correctly? If I have it like this: ‡, then it gets screwed up but if I output it with the entity code, the CSV outputs that text.
Non-printable characters in a field are sometimes escaped using one of several c style character escape sequences, ### and \o### Octal, \x## Hex, \d### Decimal, and \u#### Unicode.
So just escape your non-ascii character C#-style and you'll be fine.
I'm not sure what you mean by "it gets screwed up".
Regardless, it is up to the receiving program or application to properly interpret the characters.
What this means is that if you put ‡ in your csv file then the application that opens the CSV will have to look for those entities and understand what to do with them. For example, the opening application would have to run an html entity decoder in order to properly display it.
If you are looking at the CSV file with notepad (for example) then of course it won't decode the entities because notepad has no clue what html entities are or even what to do when it finds them.
Even Internet Explorer wouldn't convert the entities for display when opening a CSV file. Now if you gave it a .html extension then IE would handle the display of the file with it's html rendering engine.

read content of file with php and send to flex via amfphp

I am creating some application in flex and one of my purposes is to read content of file and display it in flex. There is huge problem, when I have file written in polish (which contains some special characters) because amfphp transfers this contents few seconds, which is to long (reading and sending content of file without any polish character if fast).My php code reads any files fast, so problem is on amfphp side. Is there any solution or I have to go with HTTPService and load contents of file directly from flex??
Thanks for any tips.
Amfphp uses the charset ISO-8859-1 by default, and those special characters are not supported by ISO-8859-1. Flash does support special characters because it uses UTF-8 by default. You need to change the setting in gateway.php. Finding a line like
$gateway->setCharsetHandler( "utf8_decode", "ISO-8859-1", "ISO-8859-1" );
and replace with
$gateway->setCharsetHandler("utf8_decode", "UTF-8", "UTF-8");
You can read the notes at the beginning of gateway for reference.

Resources