In PHP, how can I store a string from an input field in a MySQL database, and then retrieve them and display them on a page exactly like it was typed into the input field? It shouldn't matter what type of character encoding is used, even if it's a Chinese or something like that. What functions do I need to apply to the strings in PHP? And what collation do I need to use for my database?
            Asked
            
        
        
            Active
            
        
            Viewed 148 times
        
    0
            
            
        - 
                    Just use UTF-8 [all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Mark Baker Jan 01 '15 at 13:21
1 Answers
0
            
            
        You need to set the character encoding collation in your mysql database: e.g.
utf8_general_ci
and you need to set the encoding of your page to display the driven content as they are: e.g.
header('Content-type: text/html; charset=utf-8; http-equiv=Content-Type');
 
    
    
        M Reza Saberi
        
- 7,134
- 9
- 47
- 76
