Re: Magic Quotes or Curley Quotes or Something

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Lance--

On 8/5/05 2:18 PM, "Lance Earl" <lance@xxxxxxxxxxxxx> wrote:

> I recently upgraded my server. It is running Ubuntu Linux with PHP and
> MySQL. My site allows people to post content to their own web oages
> through a web interface. Many of my customers compose their content on a
> word processer and then cust and paste it to the web interface for
> insertion to the database and later retrevial and display on a web page.
> 
> The problem I am having is that content which includes quotes is is not
> being seen correctly. Rather than inserting a slashed quote (/"), it
> inserts a bunch of strange formatted gunk. A sample of the problem anc be
> seen at www.dallypost.com/ranch/page5688.php
> 

You have an encoding problem--the content is being uploaded to your site
using a different encoding mechanism (most likely utf-8) than the one you
use to display it. 

I'm not much of an expert in this area, but a couple of suggestions:

1. You're already outputting UTF-8 code from the looks of it, so a simple

Header ("Content-type: text/html; charset=utf-8");

Or even adding this to your HTML code in the <HEAD>:

<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">

Should do it. Remember to also use htmlentities ($data, null, "utf-8"); to
properly encode the entities in your content.

2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use
utf8_decode, or you may have to go with the mbstring extension (not too sure
here, I'd just go ahead and convert everything over to UTF-8).

I'm sure some other people who have more experience with this stuff can give
you even more pointers, but this should get you started.

Cheers,


Marco

--
BeebleX - The PHP Search Engine
http://beeblex.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux