Webpage Charset

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
alexrules01
Posts: 175
Joined: Sun Oct 11, 2009 9:33 am

Webpage Charset

Post 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!
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: Webpage Charset

Post by Chris »

No, and you are looking for a rich text editor plugin.

http://www.queness.com/post/212/10-jque ... xt-editors
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Webpage Charset

Post 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.
The indelible lord of tl;dr
alexrules01
Posts: 175
Joined: Sun Oct 11, 2009 9:33 am

Re: Webpage Charset

Post 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
Post Reply

Return to “Advanced Help and Support”