Welcome Guest, Not a member yet? Register   Sign In
store special characters in mysql
#1

[eluser]Arun Joshi[/eluser]
Hi,

How to store special characters in mysql. When I copy some content from other sites (most time mathematical symbols like theta, pi etc), it stored as '?' in mysql. Is there any way to solve that? mysql field type is varchar. I am using $this->input->post('field')) and global xss filtering is on now.

eg:
Code:
arθu‾n

-Arun
#2

[eluser]cideveloper[/eluser]
2 questions.
1) What type of collation are you using on your database/tables? utf8, latin1, etc.
2) What are you using to manage/view your databases. phpMyAdmin, or some other software.

This issue is usually cause by either using incorrect collation which causes the values to be stored incorrectly or by the software used to manage the DB which causes the values to show up incorrectly even though they are stored correctly. I once had an issue with the pound symbol showing up wrong and it was the script used to display the character that was doing it.
#3

[eluser]Arun Joshi[/eluser]
my table collasion is MyISAM latin1_swedish_ci
#4

[eluser]cideveloper[/eluser]
I have had nothing but problems with latin1_swedish_ci. I have switched everything to utf8_general_ci. I develop for a number of companies in the domain name industry and all of them were having problems storing special characters and dealing with IDNs until we moved to utf8_general_ci. It should be no problem to switch a current database/table to utf8_general_ci but I TAKE NO RESPONSIBILITY FOR LOST DATA. Bestt bet is to create another table with the utf8_general_ci collation and copy data from old table to new one. Hope this helps and works.




Theme © iAndrew 2016 - Forum software by © MyBB