[thelist] displaying character entities in textareas

Pete Prodoehl pete.prodoehl at cygnusinteractive.com
Tue Nov 11 10:20:26 CST 2003


Kae Verens wrote:
> I am writing a gui for some text formatting codes that I use in my CMS, 
> and am having a bit of trouble doing what I want to do.
> 
> As an example, I presently enable bold type similar to here:
> "this is *bold* text" - my text filter then strips out those asterices 
> and replaces them with <strong> and </strong>
> 
> I want to stop using the asterix character for this purpose, though, and 
> the others I use ('/' for italics, '_' for underline, etc), and replace 
> them with other more unlikely-to-be-mistakenly-used characters.
> 
> For example, underline might use the &micro; sign, which looks like a 
> 'u', but is unlikely to crop up in a paragraph.
> 
> The trouble is - I'm trying to insert these characters into textareas on 
> teh click of a button - how can I enter character entities into a 
> textarea? When I try with teh HTML of it, it simply shows up as 'This 
> text is &micro;underlined&micro;", which is just daned ugly - I want the 
> actual character to be placed instead.


I don't have a solution to your problem, but a suggestion... Instead of 
using a text filter to change *foo* into <strong>foo</strong> have you 
considered using Textile, the 'humane web text generator'?

   <http://textism.com/tools/textile/>

There are versions written in PHP, Perl, Python, and even ASP... I found 
it very easy to use the Perl version written by Brad Choate into a 
simple CMS I wrote...

Back to the problem - my guess is the textarea of a browser displays 
text (hence the name) not HTML, so I don't know if you'll get what you 
want to work...

Pete





More information about the thelist mailing list