Tried referencing all the other posts on this matter but no luck.
The issue that, there are posts in English, Tamil and Sinhala (native language of Sri Lanka). The english articles are fine. But for sinhala and tamil the characters show ????? ?? ??? after being saved or updated. What we do is we copy and paste from google translate and transliterate directly to the wordpress editor.
I have checked the mysql table and it also shows the ??? ??? characters. But when inserted directly into the DB using phpmyadmin the characters display fine. Both in phpmyadmmin as well as in wordpress. But once edited or updated it goes back to being ??? ????.
Wordpress char set is utf8 and collate is ''. Tried changing them to various settings and commenting out also but nothing worked so far.
Does anyone know the solution. We have the same setup on another test server and all the functions works on that server without any issue. Is there a specific PHP setting (btw, default charset in php ini is set to utf8) that is causing the problem?
The CHARSET is important; the COLLATE is not (for this question).
This is probably what happened.
You are INSERTing non-western-Europe text
You said SET NAMES utf8 to declare that the client bytes are utf8-encoded (correct).
But the columns are declared CHARSET latin1.
Since there is no way to convert Chinese characters into latin1, '?' stored.
Please provide SHOW CREATE TABLE so we can verify that the column is not utf8.
Related
For multi language, i have tried mysql collation with "utf8_unicode_ci" and also "utf8mb4_unicode_ci", but i getting issues.
1) when i update the text by coding. the output in phpmyadmin showing "எமà¯à®à®ªà®¿" junk character, but the output in website is displaying correctly.
2) when i update the text by directly in phpmyadmin. the output in phpmyadmin showing correct, but the output in website is showing "??????" characters.
How to showing correct in both phpmyadmin and website?
Note: the language text is tamil text
You need to use utf8_general_ci encoding for multi-language is widely used.
Also, when you need to do operation from code set character encoding to utf8 from mysql.
Hope fully it will solve your issue.
I have a php netbeans project. The encoding for the project is UTF-8. Special characters display correctly in the ide. (img 1)
I use phpmyadmin and the encoding for the entire database is utf8_unicode_ci (the column also shows this). (img 2)
I use mysqli to connect, and it doesn't make any diference if I call
set_caharset("utf8");
(img 3)
In the browser everything is ok (including searches with special characters):
(img 4)
But in phpMyAdmin the text introduced through mysqli is scrambled (whilst text introduced manually is ok - id 13 in the picture) (img 5)
What should I do to send text correctly in phpmyadmin.
[edit] Some more info. I don't know how to interpret or use this, bu this is what
SHOW VARIABLES LIKE 'character_set%'
displays.
Variable_name: Value
character_set_client: utf8mb4
character_set_connection: utf8mb4
character_set_database: latin1
character_set_filesystem: binary
character_set_results: utf8mb4
character_set_server: latin1
character_set_system: utf8
character_sets_dir: D:\Programe\XAMPP\mysql\share\charsets\
[edit2] Ok, it is something that is server related. I uploaded the same code that generated the database on a different server and everything is ok. Do you have any ideas where the problem could be?
It's resolved!
I'm not sure how, because I made multiple modifications before testing.
Where I edited:
on the front-page of phpmyadmin (localhost/phpmyadmin) under server colation I choose other types of utf8.
I had a different connection class for the setup where I didn't call: set_caharset("utf8");
I am having a big problem with character encoding accross my domains. The big thing for me really is that I don't understand it. I set all my websites to be utf-8 using the meta tag:
<meta charset="UTF-8">
Which seemed to have solved a few problems a while back. Now I am seeing problems with between the website and the database, when a user enters their first or last name, and it has an accent in it, it doesnt display correctly. However I ran the following test.
I created a test table called 'test' (imaginative I know)
I wrote a very tiny script to take the value from a text box and put it into this table and then display the contents of this table each time this page displays, so I could see what is going on.
Here are some screen shots, first, from the output of the page:
And then a screenshot of the database itself:
So the type of column first is VARCHAR(50), I just left the settings as I would do normally, and the character encoding was latin_swedish1 or something. After id 4, I changed it utf8_bin, but that still didnt make a difference.
The problem is, the data still display okay on the website, but looks terrible in the database. Is that a problem, is this how it should be done? I think the problems I the users are complaining about are when it is put into emails and PDFs etc, which I don't think I set character encoding on.
Any help and advice would be greatly welcomed.
Make sure to have the charset is utf8 when you created the table.
create table my_table (
id int primary key,
.....
) engine=innodb charset=utf8;
and make sure that your connection is setting the charset for utf8. it depends on each framework you're using.
You can set internal character to utf-8 /* Set internal character encoding to UTF-8 */
mb_internal_encoding("UTF-8"); check http://php.net/manual/en/function.mb-internal-encoding.php
Try to use utf8_general_ci. This will solve troubles.
When the3 column type was assigned, how was it assigned? I would ensure that it was along the lines of VARCHAR(n) CHARSET utf8 as that would make your column type correct for the UTF8 standard, more normally I see the UCS2 (VARCHAR(n) CHARSET ucs2) which can then cause problems later down the line.
you can set this using NVARCHAR ( see http://dev.mysql.com/doc/refman/5.0/en/charset-national.html) since sql 5.
To change the type of a column on its own you can use this type of command:
Alter table tablenamehere MODIFY columnidhere newdatatypehere;
for example
Alter table mytabelforphp MODIFY oldvarcharcolumnId nvarchar(1024);
Let me know if you need more info:)
also add your character encoding to database connection
if you have mysqli connection use :
mysqli::set_charset
if you use PDO follow this:
PDO_MYSQL DSN
I created an Arabic website using PHP 5.3, MySQL 5 and PHPMyAdmin 3.4.
On every page, I use the "utf-8" character set. I include the following line on every page:
http://jsfiddle.net/Hh7mk/
The website works fine offline (on local server (localhost)). Even after I edited and inserted new Arabic writings into the database.
The problem is when the website is online. All Arabic fonts are displayed properly, but after I edited or inserted new Arabic writings into the database online, the new writings are displayed as question marks.
My settings (online):
PHPMyAdmin MySQL Connection Collation : utf8_general_ci.
PHPMyAdmin MySQL charset : UTF-8 Unicode (utf8).
The database and tables collation : utf8_general_ci.
In the connection file, I have included mysqli query SET NAMES 'utf8' and SET CHARACTER SET utf8.
I also have tried to change the collation to "cp1256_general_ci", and the pages character set to "windows-1256", but the fonts still show as question marks.
Why the Arabic fonts show as question marks after I inserted/ edited them online? How to fix this?
Thank you in advance
Have you tried using mysql_set_charset
mysql_set_charset("utf8");
seems you are doing everything right. but did you make all this before inserting data?. try cleaning up database and inserting from the scratch
The ASCII ? mark's code is 63 which is the first byte of all Arabic characters (each character has two bytes). Having your strings turned to ? means that only the first bytes of your characters are stored/retrieved. This is an indication that somewhere is your store/retrieve process you've got a bottleneck in which only ASCII characters can pass. My bet is on MySQL. The best way you can find this out is to use your local server's code (a local PhpMyAdmin shall do) connecting to your production server's MySQL. If the problem remains it shows that it's MySQL's configuration doing (considering the fact that your local PhpMyAdmin works fine with your local MySQL). I can only give you ideas on how to investigate the problem. You need to find the problem itself on your own.
okee, I followed all instructions I could find here
and i could display all kinds of multilingual characters on my pages...
The problem is in phpmyadmin the japanese characters are replaced by question marks, as in a bunch of ???? ??? pieced together. I think there's a problem with my database's collation but I just wanted to verify that here.
We've had this database set before on a default collation which is latin_swedish_ci
and it already has a lot of data. Now we had to add some tables that require support for special characters, so I definitely just couldn't set the database's collation to utf8. My solution was to use utf8 only on the tables which required such support and the specific columns where we expected special characters to be contained.
But still phpmyadmin displayed them as ????.
Another question that I have is will these fields be searchable?
I mean if the field contains some japanese characters and I typed sayuri as keyword, will the japanese character equivalent to their syllables pronounced in english?
Mmm, as to your first question do you have Japanese fonts installed on your system? They aren't installed by default on most OSs, but I have no idea what your OS is. Next one is silly but are your Browser settings Ok?
Next question, the answer is no, if you search for 吉永 小百合 it wont' match with Yoshinaga Sayuri.
Note: Can you see my Japanese characters?
I had similar problem, if your headers are correct.
once you made your database connection use:
mysqli_set_charset ( $mysqli,'utf8');
or
$mysqli->set_charset("utf8");
The problem is that your connection collation is not set to utf-8 (most probably latin1), which you need to display the Japanese characters. You could set it manually by issuing the queries:
SET CHARACTER SET utf8;
SET NAMES utf8;
Or in your MySQL configuration file:
default-character-set=utf8
skip-character-set-client-handshake