Page 1 of 1

Webpage Charset

Posted: Thu Feb 21, 2013 4:44 am
by alexrules01
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!

Re: Webpage Charset

Posted: Thu Feb 21, 2013 12:44 pm
by Chris
No, and you are looking for a rich text editor plugin.

http://www.queness.com/post/212/10-jque ... xt-editors

Re: Webpage Charset

Posted: Fri Feb 22, 2013 4:10 am
by Jackolantern
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.

Re: Webpage Charset

Posted: Fri Feb 22, 2013 11:52 am
by alexrules01
That is what I originally thought. But instead it just completely cleared the whole string. *Shrugs*. At least it is working now :D