In my database I have DONT word..
In database it is stored like this:DÕNT Due to that Õ the data is not coming..!
How can i retrive that..?
This my code of retrive:
htmlspecialchars($res_get_option['answer']);
Collation: Null and Type: MyISAM
You will need to set right collation for database and update wrong characters, with right ones, using a script for this.
Related
I am unable to insert record to my database table with having data like (£ 2,000).
Can anyone help me with this ?
Thanks
Try encoding the table as:
ALTER TABLE <table_name> CONVERT TO
CHARACTER SET utf8
COLLATE utf8_general_ci;
And make sure the datatype of the column is varchar.
Also if you plan to output that data in a webpage you can to insert HTML Entities for Currencies in the db and then when you output it in a webpage, the HTML will render the entities as regular characters.
It works for me
It seems that changing the column type and collation type did this.I have changed the column type to varchar and collation to utf-8 and it worked.
I have a database table where i want to store and retrieve in English and Nepali Language. I have a following configuration:
Type: InnoDB
Database collation : utf8_general_ci
Column name: Title_ne
Data Type: text
Column Collation: utf8_unicode_ci
Now when i insert data into Title_ne field using phpmyadmin and provide something like नमस्कार using Google Nepali input for Windows, it is inserted and displayed correctly while querying in phpmyadmin. But, while i query this from php and try to display it in php page, only ???????? is displayed. Am i doing something wrong on table design or inserting data? What is wrong, please provide your suggestions.
नमस्कार is a way of Greeting in Nepal.
I have mysql database (not mine). In this database all the encodings set to utf-8, and I connect with charset utf-8. But, when I try to read from the database I get this:
×¢×?ק 1
בית ×ª×•×’× ×” העוסק במספר שפות ×ª×•×›× ×”
× × ×œ× ×œ×¤× ×•×ª ×חרי 12 בלילה ..
What I supposed to get:
עסק 1
בית תוגנה העוסק במספר שפות תוכנה
נא לא לפנות אחרי 12 בלילה ..
When I look from phpmyadmin, I have the same thing(connection in pma is to utf-8).
I know that the data is supposed to be in Hebrew. Someone have an idea how to fix these?
You appear to have UTF-8 data that was treated as Windows-1252 and subsequently converted to UTF-8 (sometimes referred to as "double-encoding").
The first thing that you need to determine is at what stage the conversion took place: before the data was saved in the table, or upon your attempts to retrieve it? The easiest way is often to SELECT HEX(the_column) FROM the_table WHERE ... and manually inspect the byte-encoding as it is currently stored:
If, for the data above, you see C397C2A9... then the data is stored erroneously (an incorrect connection character set at the time of data insertion is the most common culprit); it can be corrected as follows (being careful to use data types of sufficient length in place of TEXT and BLOB as appropriate):
Undo the conversion from Windows-1252 to UTF-8 that caused the data corruption:
ALTER TABLE the_table MODIFY the_column TEXT CHARACTER SET latin1;
Drop the erroneous encoding metadata:
ALTER TABLE the_table MODIFY the_column BLOB;
Add corrected encoding metadata:
ALTER TABLE the_table MODIFY the_column TEXT CHARACTER SET utf8;
See it on sqlfiddle.
Beware to correctly insert any data in the future, or else the table will be partly encoded in one way and partly in another (which can be a nightmare to try and fix).
If you're unable to modify the database schema, the records can be transcoded to the correct encoding on-the-fly with CONVERT(BINARY CONVERT(the_column USING latin1) USING utf8) (see it on sqlfiddle), but I strongly recommended that you fix the database when possible instead of leaving it containing broken data.
However, if you see D7A2D73F... then the data is stored correctly and the corruption is taking place upon data retrieval; you will have to perform further tests to identify the exact cause. See UTF-8 all the way through for guidance.
I'm using a database that contains contacts (fields like name, address, ...). If i'm using in my database a city that contains special chars (like ü) or html codes (like ü), then how can i convert them to u, so when i search for a city that contains that a special char should be shown in the result...
the database is MyISAM and Collation is latin1_swedish_ci (by default)
Your database shouldn't contain any HTML codes but symbols itself.
With proper collation set, you will find both ü and u with your query
Edit: using collations example
you probably want to look at this article for other ideas and tools for how to solve your search problem. Normalizing your database search to latin-1 characters isn't the right solution.
http://www.alistapart.com/articles/accent-folding-for-auto-complete/
I'm re-designing a Web site and I have a problem with the existing data base:
The database collate is set to utf8_unicode_ci and in the table row I'm calling the collate seems to be set to latin1_swedish_ci the characters store in it are Japanese (but even in phpmyadmin) you see other characters (I guess because of the latin1_swedish_ci).
When I print the result from the query I get a bunch of ??? now using
mysql_query('SET NAMES utf8');
mysql_set_charset('utf8',$conn);
Will output 2009â€N10ŒŽÂ†2009?N10???2009â€N11ŒŽÂ†2009?N11???
Any ideas?
Because the table was set to use latin1_swedish_ci, it was unable to correctly store the UTF-8 data that was entered. You need to switch that table to use utf8_unicode_ci for data going forward, but any existing data is essentially corrupted. You would have to re-enter the data after switching the collate to get the correct Japanese characters for the existing records.
You need to change the charset to utf8. The collation do not need to be changed to display japanese characters (but to be able to sort and compare texts it might be a good idea to change it to utf8_general_ci).
Hi all thanks for your reply's this is what happened, I couldn't really change anything in the DB since there's another version of the site that still uses that DB and will be up. So the solution I found was the following:
Case scenario:
The DB is set to use UTF8 -> (utf8_general_ci) but the field (at least the one's I needed where set to latin1_swedish_ci.
Solution:
After mysql_connect I put the following:
mysql_query("SET NAMES 'Shift_JIS'",$conn);
mysql_set_charset('Shift_JIS',$conn);
Then in the PHP file:
$titleJP = $row['titleJP'];
$titleJP = mb_convert_encoding($titleJP, "UTF-8", mb_detect_encoding($titleJP,"Shift_JIS,JIS,SJIS,eucjp-win"));
Now that worked perfectly the characters are displayed in correct Japanese.
I tried every other solution I could think of with no luck (utf-8_decode/encode php functions, etc.. etc..)