Batch MS DOS ASCII to Web Converter Script

Categories: ASCII, text art, Tools
Tags: No Tags
Comments: No Comments
Published on: December 25, 2009

A little script that converts MS DOS ASCII files, such as NFO’s  or FILE_ID.DIZ text files (Code Page 437, USA) to Unicode  and HTML encoded files that can be used to display the ASCII art, specifically the “High ASCII” or block ASCII art on a web site. The script is written in VBScript, but the release package also includes a Windows executable, which is the VBScript converted via VBSEdit by Adersoft.

I used the same script to prepare the ASCIIs in my text art galleries on my web site, such as:

just to name a few.

NOTE: An Updated Version of the Script is also available now!

You can download the script here:   ROY-BATCHCONVERT-ASCII2WEB.ZIP (555 KB)

For example the top logo of this NFO file, which is in DOS ASCII Format and looks like this:

     ───────── ▄ ▄▄▄▄ ▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄  ▄ ▄▄▄ ▄ ▄▄▄ ▄▄▄▄▄ ▄ ─────────
     ·R·E·L·.·  ▄ ▄▄▄▄ ▀▀▀▀▀▀███ ▀▀▀▀▀▀▀▀███ █ ███ ▀ ███ ▄▄▄▄ ▄  ·2·0·0·9·
     ─────────── ▄ ▄▄▄ ███ ▄▄██▀ █ ███ █ ███ █▄ ▀▀▀▀▀███ ▄▄▄ ▄ ───────────
                    ▄▄ ███ ▄ ███ █ ███▄▄▄▄▄▄▄▄  ▄▄▄▄▄███ ▄▄
                       ▀▀▀   ███ ▀  ▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀

would be converted to the following;

 

───────── ▄ ▄▄▄▄ ▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄  ▄ ▄▄▄ ▄ ▄▄▄ ▄▄▄▄▄ ▄ ─────────
& middot;R·E·L·.·  ▄ ▄▄▄▄ ▀▀▀▀▀▀███ ▀▀▀▀▀▀▀▀███ █ ███ ▀ ███ ▄▄▄▄ ▄  ·2·0·0·9·
& #9472;────────── ▄ ▄▄▄ ███ ▄▄██▀ █ ███ █ ███ █▄ ▀▀▀▀▀███ ▄▄▄ ▄ ───────────
               ▄▄ ███ ▄ ███ █ ███▄▄▄▄▄▄▄▄  ▄▄▄▄▄███ ▄▄
                  ▀▀▀   ███ ▀  ▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀

Note: I included the release ZIP archive are the files roy.asc and roy.web as examples also.

It would look just like the ASCII above the blue code, if you use it properly in your HTML page.

The Web encoded ASCII does not include
Tags for the line-breaks. You have to add those manually or do what I do on my web site and enclose the code in
<pre></pre>
tags, which preserves the line-breaks within the enclosed text. Since the result is Unicode and not DOS ASCII anymore, you can use any mono-space font to display the ASCII somewhat correctly. You won’t get a 100% accurate result anyway, because the old MS DOS font set is not part of Windows anymore. What you can get is only a close approximation. I use on my web site the font “Lucida Console“, which seems to be installed on many machines. If the Windows of the user who visits your page with the ASCII for example does not have that font installed, Windows will automatically pick another font that comes close. I use the following CSS formatting for the PRE tags where I show ASCIIs.

   1: pre {
   2:    background-color:#000;
   3:    color:#FFF;
   4:    display:block;
   5:    font-family:"Lucida Console", monospace;
   6:    font-size:9pt;
   7:    line-height:12px;
   8:    padding:10px;
   9:    text-align:left;
  10:  }

 

If the PRE Tag is also used for something else on your web site then you can also define it for a specific class selector like

   1: pre.asciiart {
   2: ...
   3: }

You would then also have to extend the PRE HTML tag like this:

   1:<pre class=asciiart>
   2: ...
   3: </pre>

 

The script is designed to convert all files with a specified extension (.ASC by default) to web ready files with a new extension (.WEB by default, but you could also make it .HTML or whatever).

There are two additional options, where I recommend to use the defaults (which is “yes”).

The first one is “Sanitize?

What that does, is removing ASCII characters with an ASCII code smaller than 32, which are special control characters that cannot be printed anyway, with 3 exceptions, chr(10) = line-feed, chr(13) = carriage-return and chr(9) = tab. LF and CR remain unchanged. Tab characters will be converted to 8 spaces, which is the default MS DOS tab-stop.

The second option is “HTML Encode?“, which means that all non-US-ASCII characters (the 7 bit ASCII codes) will be converted to HTML codes like . Also standard ASCII characters that could be misinterpreted by HTML or DHTML and XML are also encoded, like the ” becomes “, & becomes &, < becomes < and > becomes > etc.

Part of this package is the image “Batch-ASCII-2-Web-Steps.jpg“, which shows screenshots of all the steps where the script goes through.

You can download the script here:   ROY-BATCHCONVERT-ASCII2WEB.ZIP (555 KB)

Batch-ASCII-2-Web-Steps

You can download the script here:   ROY-BATCHCONVERT-ASCII2WEB.ZIP (555 KB)

Enjoy!
Carsten aka Roy/SAC

PS. This script is freeware. Do with it whatever you like, except selling it. You can use it free, copy it, share it, even modify it if you like to. You are using it at your own risk. You cannot make me liable for any damage or loss of data that might results directly or indirectly because of the use of my script.

Batch-ASCII-2-Web-BeforeAfter

No Comments
  1. […] is an update to my  little script that converts MS DOS ASCII files, such as NFO’s  or FILE_ID.DIZ text […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

NOTE! I believe in the right for freedom of speech and personal opinion and are against censorship, so feel free to tell me what you think and let me and others hear your opinion on this subject, but please avoid using the f-word and s-word as much as you possibly can, because at the end of the day this blog exists for the purpose of useful exchanges of thoughts, ideas and opinions and not as a valve for your accumulated anger and frustration. Get a shrink for that! Thanks.

Welcome , today is Sunday, September 24, 2017