tags:

views:

127

answers:

2

Hi, I would like to print some kind of ASCII "art" on a web page in pre-tags. These graphics use DOS characters to show a map like old maze games did. I didn't find anything in the HTML special character reference. Is there a way to use these characters in HTML ?

Thanks in advance.

+3  A: 

You can send them in the <pre> tags, although in XHTML you'll need to encapsulate it in <![CDATA[[]> I think. Be careful though, not all encodings render this correctly. For example, a lot of ASCII art designed for DOS code page 430 (US) fails over here in the UK (830). Eastern Europe suffers especially.

I think the best approach here would be to render images.

EDIT: Oh. You could try &#000, but I'm not sure if that would work.

Lucas Jones
Thanks, your '' gave me the hint to look at unicode specifications
DaClown
+6  A: 

With the right Unicode characters, the old character encodings shouldn't make much odds. The tricky bit may be converting existing ASCII art into Unicode - at which point you need to know the original encoding.

The relevant code charts will be listed on the Unicode "symbols" charts page. In particular, I suspect you'll find the box drawing and block elements charts useful.

You'll need to make sure that your page uses a font which contains the right characters, of course...

As an example, you can render this:

┌┐
└┘

With:

<pre>&#x250c;&#x2510;
&#x2514;&#x2518;</pre>

Not quite a proper box, but getting there...

Jon Skeet
Thanks, exactly what was looking for
DaClown