How to save text field input into mytable as utf8 encoded data, since textarea input automatically changing into utf8 encoded data,
            Asked
            
        
        
            Active
            
        
            Viewed 823 times
        
    1
            
            
        - 
                    You should make sure you're using the correct charset in your page. Set the `` in your header. The table in your database should of course also have a utf-8 encoding. – Cyclonecode Oct 07 '13 at 09:23
- 
                    yes, i have added, , then i too the same problem existing – Punithavel Oct 07 '13 at 09:27
2 Answers
1
            
            
        SET NAMES utf8;
That will set the next queries to be saved AS UTF-8. Execute it before your actual INSERT or UPDATE
Be warned that if the sending page has a different charset, it would lead to character encoding errors.
 
    
    
        zonzon
        
- 168
- 4
0
            Firstly, make sure that your database table is set to character set UTF-8.
Secondly, set the page your are submitting data from as UTF-8 with the following meta tag:
<head>
<meta charset="UTF-8">
</head>
Then when making your connection to the database you can execute the following query to set any subsequent queries to the UTF-8 character set too:
query("SET NAMES utf8"); 
See: SET NAMES utf8 in MySQL? and http://www.w3schools.com/tags/att_meta_charset.asp
 
     
    