To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Database

Database Conversation regarding PHP and SQL

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-03-2009, 06:18 PM   #1
code-up
Junior Member
 
Join Date: Nov 2009
Posts: 2
utf problem with html form

over a week i am reading articles about utf8 and how to be compatible with php and mysql, however i didn't solve my problem.

my problem is: when I send data using normal html form to mysql database, this data appear like : ???????????. wrong characters.
although my database encoding is utf-8 as its tables. and I have meta tag in the page which said that charset=utf-8 ...

may be usefull to know , i am using PDO to connect to mysql. and smarty to deal with templates.
PHP Code:
  // Create a new PDO class instance
        
self::$_mHandler = new PDO(PDO_DSN, DB_USERNAME, DB_PASSWORD, array( PDO::ATTR_PERSISTENT => DB_PERSISTENCY));
        
        
self::$_mHandler->query('SET NAMES utf8');
code-up is offline   Reply With Quote
Old 11-05-2009, 09:01 AM   #2
Roger Ramjet
Senior Member
 
Roger Ramjet's Avatar
 
Join Date: Jul 2004
Location: Leeds, UK
Posts: 4,293
Probably because your form data is being sent from any browser on any operating system, probably IE on winders. What you need is to set the form data to utf8 as well
__________________
David Soussan
Roger Ramjet is offline   Reply With Quote
Old 11-05-2009, 09:09 AM   #3
Roger Ramjet
Senior Member
 
Roger Ramjet's Avatar
 
Join Date: Jul 2004
Location: Leeds, UK
Posts: 4,293
Quote:
Originally Posted by Roger Ramjet View Post
Probably because your form data is being sent from any browser on any operating system, probably IE on winders. What you need is to set the form data to utf8 as well
ON second thoughts, set it to enctype="text/plain" explicitly.
__________________
David Soussan
Roger Ramjet is offline   Reply With Quote
Old 11-05-2009, 09:35 AM   #4
code-up
Junior Member
 
Join Date: Nov 2009
Posts: 2
Thank you so much friends. you will not believe me if said I solve the problem by chance. I just re-build my database with same settings as old one.. and every thing go well ......... why ; I don't know
code-up is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 04:44 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.