Re: [PHP] question about database field-types and special characters

2008-02-18 Thread Richard Lynch
On Thu, February 14, 2008 8:47 pm, Rob Gould wrote:
 Should I have used utf-8 instead?

Yes.

And you need to convince not only the MySQL server to use UTF-8, but
also the MySQL client compiled into your PHP to use UTF-8.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] question about database field-types and special characters

2008-02-15 Thread tedd

At 12:10 AM -0500 2/15/08, Robert Cummings wrote:

  Or, and this is what I would do, convetr your database to UTF-8. That

 way you're prepared for the rest of the world. In this day and age I
 would creat a site with anything but UTF-8.


Wouldn't create a site with anything but UTF-8.



That's better.

You had me concerned there.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] question about database field-types and special characters

2008-02-14 Thread Robert Cummings

On Thu, 2008-02-14 at 18:47 -0800, Rob Gould wrote:
 I've got a PHP application that pulls in data from a mySQL database.  The 
 data is a series of wine producers, and many of them have special foreign 
 characters over the a's and o's.  
 
 When I go and view the data from my database using myPHPAdmin, the characters 
 look fine, but when I pull the data into my web-page the special characters 
 get messed up.
 
 For whatever reason, when I first set up the database, someone told me to 
 preserve special characters by setting my collation for the wine-producer 
 field to latin1_swedish_ci.  The data seems to be in there ok, so at least 
 that works.
 
 Should I have used utf-8 instead?  Can I set something in the doctype or 
 header of my web-page to make it so that my website displays 
 latin1_swedish_ci-based characters properly, or should I change my database 
 field-type to be something different?  My main fear is messing up the 
 database (I'll back up first if I have to chance the field collation)

SOunds like your website is UTF8 and your DB as you say is latin1. You
have a few choices. You can set the php.ini config value:

default_charset = iso-8859-1

You can also set the meta tag (probably best to set the PHP config and
the meta tag):

meta http-equiv=Content-Type content=text/html;
charset=iso-8859-1 /

Or, and this is what I would do, convetr your database to UTF-8. That
way you're prepared for the rest of the world. In this day and age I
would creat a site with anything but UTF-8.

Here's some reading for you:

http://www.joelonsoftware.com/articles/Unicode.html

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] question about database field-types and special characters

2008-02-14 Thread Robert Cummings

On Thu, 2008-02-14 at 23:59 -0500, Robert Cummings wrote:
 On Thu, 2008-02-14 at 18:47 -0800, Rob Gould wrote:
  I've got a PHP application that pulls in data from a mySQL database.  The 
  data is a series of wine producers, and many of them have special foreign 
  characters over the a's and o's.  
  
  When I go and view the data from my database using myPHPAdmin, the 
  characters look fine, but when I pull the data into my web-page the special 
  characters get messed up.
  
  For whatever reason, when I first set up the database, someone told me to 
  preserve special characters by setting my collation for the wine-producer 
  field to latin1_swedish_ci.  The data seems to be in there ok, so at 
  least that works.
  
  Should I have used utf-8 instead?  Can I set something in the doctype or 
  header of my web-page to make it so that my website displays 
  latin1_swedish_ci-based characters properly, or should I change my database 
  field-type to be something different?  My main fear is messing up the 
  database (I'll back up first if I have to chance the field collation)
 
 SOunds like your website is UTF8 and your DB as you say is latin1. You
 have a few choices. You can set the php.ini config value:
 
 default_charset = iso-8859-1
 
 You can also set the meta tag (probably best to set the PHP config and
 the meta tag):
 
 meta http-equiv=Content-Type content=text/html;
 charset=iso-8859-1 /
 
 Or, and this is what I would do, convetr your database to UTF-8. That
 way you're prepared for the rest of the world. In this day and age I
 would creat a site with anything but UTF-8.

Wouldn't create a site with anything but UTF-8.


:)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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