0

I have a field with latin1_swedish_ci collation and inserted data is visible to me as a set of question marks ????????.

enter image description here

How to convert existing (??)question mark data with original data?

Note:(???)question mark data in table in actually in gujarati language data.

I am using code-igniter,mysql and phpmyadmin

Maulik Nai
  • 19
  • 2
  • 7
  • Hi Maulik. Please include sample of your table structure & data and also the query you have tried into your question. Thanks – FanoFN Oct 18 '19 at 05:47
  • I am edit my question and attached my one data – Maulik Nai Oct 18 '19 at 05:58
  • check: https://stackoverflow.com/a/15605490/7356355 – user158 Oct 18 '19 at 06:11
  • See Question Marks in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored - it lists the likely configuration problems that cause that problem. – Rick James Oct 18 '19 at 17:08

3 Answers3

1

Try changing the column's character set sample code is below.

ALTER TABLE `your_table` 
CHANGE COLUMN `name` `name` VARCHAR(45) 
CHARACTER SET 'utf8' NULL DEFAULT NULL ;

Note:
When records are already ??????? in the table, the data to be reinserted again.

The existing data will not change once collation changes.

James
  • 1,819
  • 2
  • 8
  • 21
  • i will try your query but it will affect 0 row. collation is chnages latiion1_swident to utf8 but inserted data (???? question mark) not replace with (typed by client) data. please help me – Maulik Nai Oct 18 '19 at 07:58
  • this was typed by user in other language and i boss client want to know exact data – Maulik Nai Oct 18 '19 at 08:06
  • Then there is no option to get back the data back. Should have tested this for other languages or need to accept the fault and move on. – James Oct 18 '19 at 08:39
  • If you need confirmation then try asking a new question then the community will share their knowledge. – James Oct 18 '19 at 08:40
  • 2
    Beware - There are different ways to use `ALTER`. Using the wrong technique only makes things worse. http://mysql.rjweb.org/doc.php/charcoll#fixes_for_various_cases – Rick James Oct 18 '19 at 17:10
0

Cause

The default encoding for inbound connections isn't set properly. DEFAULT CHARSET will return as utf8 however character_set_server will be something different. In the above, the character_set_server was set as latin1.

Resolution

Set default-character-set=utf8, as detailed in Configuring Database Character Encoding.

sibabrat swain
  • 1,277
  • 8
  • 20
0

Most probably you can change the collation through the phpmyadmin page

Follow this steps

1) Select you database

2) Go to Operations in the menu

3) Scroll Down to the bottom and you will see the collation

Change the collation and click GO

enter image description here

Cyrille Con Morales
  • 918
  • 1
  • 6
  • 21