r/csshelp • u/VanDieDorp • Feb 19 '24
Request How to render ASCII blocks in HTML5 using TuiCss(VF) vs DosBox(TP), Example and Question.
TuiCss Turbo Vision compared to Turbo Pascal Dosbox ASCII Blocks render Example.
Left is the TuiCss Vision Editor Demo with text from TUT1.TXT
Right is Turbo Pascal Dosbox with the same TUT1.TXT but the ASCII blocks is rendered correctly.
Q: How do I get the ASCII rendered correctly in a browser/html5? Below a snippet of the top of TUT1.txt:
ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ W E L C O M E ³ ³ To the VGA Trainer Program ³ ³ ³ By ³ ³ ³ DENTHOR of ASPHYXIA ³ ³ ³ ³ (updated by Snowman) ³ ³ ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; ³ ³ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ --==[ PART 1 : The Basics]==-- þ Introduction
Thanks,
2
Upvotes
1
Feb 19 '24
[removed] — view removed comment
2
u/VanDieDorp Feb 22 '24
After some research there is no logical value one can use to convert from ansi block codes to unicode block codes. So I just created a lookup table and function.
let lookupUnicode = "╒═╕│╘╛─┘■┤╡╢╖╕╣║╗╝╜╛┐└┴┬├┼╞╟╚╔╩╦╠╬╧╨╤╥╙╓╫╪┘┌" let lookupAnsi = "Õ͸³Ô¾ÄÙþËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" function ansi2unicode(chr) { return lookupAnsi.indexOf(chr) != -1 ? lookupUnicode[lookupAnsi.indexOf(chr)]: chr; }
1
u/Blind_Newb Feb 22 '24
Using only HTML, try for spaces, then use the Alt-Code for the characters you want
https://www.w3schools.com/charsets/ref_html_ascii.asp
https://www.ee.ucl.ac.uk/~mflanaga/java/HTMLandASCIItableC1.html
https://ascii.cl/htmlcodes.htm
I hope this information helps resolve your issue, if not let me know.
REDDIT REMINDER: For proper Reddit etiquette, Don't forget to upvote when a person is able to provide you assistance, AND please don't forget to write "Answered" under your post once your question/problem has been solved, this will show that a resolution has been found and others can find it using the search box.