/    Sign up×
Community /Pin to ProfileBookmark

special chars in textarea

[U]I had vailed to catch the place where I assigned the original POST. Special chars don’t show after they’re posted again, but at least it works.[/U]

I’m trying to provide a very light editor… Goal is that someone can type in some html and then preview it in a div lower in the page. I.e. generate a short letter to be sent in html email.

The text area seems to barf on some special characters. I.e.  , etc. Other’s, it leaves alone. The div ends up with non-ascii characters in it as well.

I’ve tried various combinations of PHP’s stripslashes/htmlentities, etc. (testing on php 4 where magic_quotes is on) but always end up with one weird result or another. Either the textarea editing window looses the special chars, or the preview window ends up with lots of little diamonds with question marks in the middle of them (some kind of character interpretation).

So is there a clean way to collect html in a textarea and the display it in a div after a POST?

Getting frustrated….

Thanks for any help/insight you can provide.

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@Major_PayneJul 17.2007 — To find your own post, use the search function or click on your Username and select Find all posts by Your_UserName. You may have been answered already in original post on this topic.

Ron
Copy linkTweet thisAlerts:
@foxbeeflyJul 26.2007 — What character-set are you using in your declaration (if any) ?

Something like:

<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
Copy linkTweet thisAlerts:
@tbirnsethauthorJul 26.2007 — UTF-8

It is/was a PHP get_magic_quotes_gpc() issue.... PHP is trying to be too helpful.

tony
×

Success!

Help @tbirnseth spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...