php - Uni-Code not going well on database & interface at same time? -
this question has answer here:
- utf-8 way through 14 answers
i have hindi , urdu writing stored in database xampp there set utf8_unicode_ci
, firstly wrote line <meta http-equiv="content-type" content="text/html; charset=utf-8">
on webpage before <title>
tag , replace uper line line <meta charset="utf-8"/>
.
when insert values in 'phpmyadmin' , show values on webpage shows ?????
question marks on webpage in 'phpmyadmin' shows fine uni-code writing.
and update uni-code columns through webpage after updating values they got nice view of writing on webpage time in database column shows آب Ùˆ Ûوا
these type or charters.
now m not getting happning correct 1 side, other side transformed in 'unicode-less'.
this web page code , m using php 5.6.11
<!doctype html> <html> <head> <link href="drop_down.css" rel="stylesheet" type="text/css" /> <link href="tooplate_style.css" rel="stylesheet" type="text/css" /> <meta charset="utf-8"/> <title>main page</title> </head> <body> <div> <div align="right"> <form action="logout.php" method="post"> <input type="submit" value="log out" class="lbtn" name="l_btn"> </form> </div> <header align="center"><a href="index.html"> talash -e- haraf </a> </header> <nav align="center"> <form action="" method="post"> <input name="srch" type="text" class="searchbar" placeholder="select language , type word here"> <select name="drp_dwn" class="dropdown dropdown-select" onchange="location = this.options[this.selectedindex].value;"> <option>--please select--</option> <option value="srch_ru.php">roman</option> <option value="srch_e.php">english</option> </select> <input name="btn" type="submit" class="button" value="search"> </form> </nav> <div align="right"> <table class="responstable"> <tr> <th>pos</th> <th>roman</th> <th>urdu</th> <th>significance</th> <th>hindi</th> <th>english</th> <th>type</th> <th>action</th> </tr> <tr> <?php $db=mysqli_connect("localhost","root","","app"); foreach($db->query('select * lafaz') $obj) { ?> <td> <?php echo $obj["pos"] ?></td> <td> <?php echo $obj["roman"] ?></td> <td> <?php echo $obj["urdu"] ?></td> <td> <?php echo $obj["important"] ?></td> <td> <?php echo $obj["hindi"] ?></td> <td> <?php echo $obj["english"] ?></td> <td> <?php echo $obj["type"] ?></td> <td> <a href="detail.php?id=<?php echo $obj['id']; ?>"> <img title="view detail" src="detail.png" width="40px" height="35px"/> </a> <a href="edit.php?id=<?php echo $obj['id']; ?>"> <img title="edit item" src="edit.png" width="40px" height="35px"/> </a> <a href="delete.php?id=<?php echo $obj['id']; ?>"> <img title="delete item" src="delete.png" width="40px" height="35px"/> </a> </td> </tr> <?php } ?> </table> </div> </div> </body> </html>
you need make sure whole chain database response of webserver using utf-8. don't give enough information give more concrete advice, check 2 things:
a) files (.php, etc.) utf-8? text editor or ide should show information , allow convert them if not.
b) meta tags in html not right way go. fallback if web server isn't configured correctly. use developer tools built browser (usually reachable f12
, use "network" tab) check if server returns content-type
header charset, e.g.
content-type: text/html; charset=utf-8
if not add line
adddefaultcharset utf-8
to apache web server configuration (http.conf
or .htaccess
).
you'll need give more information, if need more help.
Comments
Post a Comment