php and mysql database turkish character -


Hello friends, I know that this question is in StakeVareflow, but I look for answers to all the questions, but solutions for me No. My problem is mysql and php turkish character problem

I call it & lt; meta & gt;

  & lt ;! DOCTYPE HTML Public "- // W3C // DTD XHTML 1.0 Transcriptional // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; & Lt; meta http-equiv = "content-type" content = "text / html; charset = UTF-8" />   

But the Turkish character is watching this: a ?? One ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · p>

I try the DB connection like this:

  & lt ;? Php define ('DB_SERVER', 'localhost'); Define ('DB_USERNAME', 'root'); Define ('DB_PASSWORD', 'root'); Define ('DB_DATABASE', 'test'); Mysql_query ("SET NAMES UTF8"); $ Connection = mysql_connect (DB_SERVER, DB_USERNAME, DB_PASSWORD) or die (mysql_error ()); $ Database = mysql_select_db (DB_DATABASE) or die (mysql_error ()); ? & Gt;   

But the Turkish character problem continues.

Matching my phpmyadmin 3 tables matching: utf8_general_ci

Message table matching: latin1_swedish_ci

  & lt ;? Php $ wall = New Wall_Updates (); If (hasset ($ _ POST ['update'])) {$ update = mysql_real_escape_string ($ _ POST ['update']); $ Data = $ wall & gt; Insert_Update ($ ID, $ Update); If ($ data) {$ msg_id = $ data ['msg_id']; $ Message = tolink (htmlentities ($ data ['message'])); $ Time = $ data ['created']; $ Id = $ data ['uid_fk']; $ Name = $ data ['name']; $ Face = $ wall & gt; Gravatar ($ id); // $ commentsarray = $ wall & gt; Comments ($ msg_id); ? & Gt;   

How can I resolve Turkish letter problem by screenshot links like this?

  $ Ajax ({type: "POST", url: "(" # commentload "+ id) .append (html); $ (" # ctextarea "+ id) .val ('')" data "; $ (" # ctextarea "+ Id.) Focus ();}});} The description is false;});    

HTML entities:

HTML encoded entities in the database in your view mean that you are changing it by applying it to htmlentities before saving your data in DB .

Unfortunately if your PHP version & lt; 5.4 optional parameter $ encoding is passed to UTF- 8 , it behaves like your string ASCII.

Multi-byte vs. Single-Byte:

This multi-byte character Because the single-byte characters and HTML are encoded before saving.

When you retrieve data from the database, you can use HTML entities in the HTML source code (ex: & amp; ; Etthold; ), but your browser will present them to the way you are viewing them.

htmlentities should correct your problem and it is recommended or you can try to use html_entity_decode before outputting the data (Not sure that this will not cause more trouble).

How to check HTML entities:

Look at the site's HTML source code and check whether there is any organization in the text from DB (Example: & Amp; atilde; ).

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -