Replace and/or Translate Legacy File Characters in vb.net

Good Morning! It was an easy night. My wife had band practice and the kids were gone (my oldest to work and the youngest to camp) so I had a lot of time to myself. Which sometimes can be nice too. :). Anyway, yes my youngest called again from camp and the nurse ended up taking the phone away because she was acting somewhat hysterical when she found out her mom wasn’t coming to get her. It also appears my dad, who is at the same camp as the nature guide, told them not to allow her to leave camp. I am going to have to address that with him. I don’t disagree with not letting her leave but I didn’t like him stepping in like that. Oh well. So she will be coming home Friday and not a moment too soon from her opinion I am sure.

So today’s topic. This code was actually written years ago. Those of you who are involved with reading files from legacy systems such as AIX, UNIX will want to pay attention in particular. Also those of you who use the Dart Telnet components will find this interesting. Those of you who use IBM 3151 emulation (or other similar) on your systems, I found a way to translate the upper function keys. That could be the subject of a future post or if you want let me know you want that information and i will correspond with you directly.

Anyway, I had to find a way to translate what those systems do in a file to make a line break happen, a tab and etc. Usually though those files when brought to the Windows side would represent these markers as a simple square. It would do that because to Windows these characters had no meaning. But the actual information was there. It was just a matter of determining what was in it and what it meant. So here is what I came up with. This is assumes you are reading a single line of text from a flat file. If you need to, do a loop and and run this function. Or read the whole thing for all I care. 🙂