ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

store special characters in mysql

January 03, 2011 10:51am

Subscribe [2]
  • #1 / Jan 03, 2011 10:51am

    Arun Joshi

    51 posts

    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:

    arθu‾n

    -Arun

  • #2 / Jan 03, 2011 11:30am

    cideveloper

    312 posts

    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 / Jan 03, 2011 11:45am

    Arun Joshi

    51 posts

    my table collasion is MyISAM latin1_swedish_ci

  • #4 / Jan 03, 2011 12:09pm

    cideveloper

    312 posts

    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.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases