Friday, 13 October 2017

php file character encoding, mysql database character encoding, special characters

I've a mysql db with some special characters, an input
form, some php
pages.




  • In my
    first php page (requestPage) I have the input
    form.


  • This page sends (through GET) a
    parameter to an other php page
    (ResultsPage).


  • At last this php page
    (ResultsPage) send a query with the parameter to the dbms and shows
    results.




/>


RequestPage is encoded as utf-8
through




  • meta
    http-equiv="Content-Type" content="text/html;
    charset=utf-8



ResultsPage
is encoded as utf-8
through




  • meta
    http-equiv="Content-Type" content="text/html;
    charset=utf-8


  • header('Content-type: text/html;
    charset=utf-8');



The
database and its tables are encoded as
utf8_general_ci.



/>

Now, for
instance:





  • if I
    put in the form of RequestPage the word "Cantu", the resultsPage executes the query and
    show me every entry of the DB with the word "Cantù" and for me its
    OK.

  • If I put in the form of RequestPage the word "Cantù",
    the resultsPage executes the query and show me no rows but I want to see the rows with
    the word "Cantù"!



Any
suggestion?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...