I am currently building a website for my auntie and she wants to copy+paste text from an editor (mostly Word) into a form on the website, which will be a textarea.
I have been building this site from scratch. I currently have a textarea, and I was running the information entered into the textarea through the htmlentities function. If I just had words it was ok, but I also used apostrophe's, which got rid of all the information and it was like there was nothing submitted.
I've been looking around the internet to find the problem, and found out because I'm pasting from Word, the apostrophe's are different and not an ASCII defined symbol - or something along those lines.
So after further research i have found putting <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> under the doctype, (I am using the HTML 5 doctype btw) has made it work, using htmlentities then running the string through htmlspecialchars_decode.
My main question is, will using <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> pose any other problems? I am not that knowledgeable of charsets etc and don't want to have this on my page only for something else to screw up. I know without knowing what else I have it is hard, but are there any common problems associated with it? Or is it all good
Also, a side question. Does anyone know a good source or tutorial etc. on creating a textarea which would retain all formatting, fonts, colours etc from Word? My auntie has used a Wordpress site and wants it to be pretty intuitive like that, and whilst I've told her I am not at that stage yet, I would like to try and incorporate something like that in the future.
Cheers!
Webpage Charset
Re: Webpage Charset
No, and you are looking for a rich text editor plugin.
http://www.queness.com/post/212/10-jque ... xt-editors
http://www.queness.com/post/212/10-jque ... xt-editors
Fighting for peace is declaring war on war. If you want peace be peaceful.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Webpage Charset
Chris! Where you been?
On-topic:
That is odd. htmlentities() should not be removing anything, but turning it to HTML entities (like < ). Apostrophes should become ' if encoded.
On-topic:
That is odd. htmlentities() should not be removing anything, but turning it to HTML entities (like < ). Apostrophes should become ' if encoded.
The indelible lord of tl;dr
-
- Posts: 175
- Joined: Sun Oct 11, 2009 9:33 am
Re: Webpage Charset
That is what I originally thought. But instead it just completely cleared the whole string. *Shrugs*. At least it is working now