![]() |
MsSql Server 2000 collation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: MsSql Server 2000 collation (/showthread.php?tid=20526) |
MsSql Server 2000 collation - El Forum - 07-13-2009 [eluser]0plus1[/eluser] MsSql server 2000 uses: sql_latin1_general_cp1_ci_as instead of UTF-8. Setting this in the db_collat option in the database configuration file seems to work, I was wondering if CI has any kind of helper to output utf-8 from sql_latin1_general_cp1_ci_as. Thank you MsSql Server 2000 collation - El Forum - 07-13-2009 [eluser]TheFuzzy0ne[/eluser] No, CodeIgniter doesn't have such a helper. You should be able to set the table collation when you create the table, and the data will be stored and passed back with that encoding. MsSql Server 2000 collation - El Forum - 08-07-2009 [eluser]fdog[/eluser] You could always extend the text helper to achieve that output. Code: /** Use the latin2utf function when you work with mssql. MsSql Server 2000 collation - El Forum - 08-07-2009 [eluser]InsiteFX[/eluser] The World Wide Web uses UTF8 for database collation. All of us shoud being using UTF8 for our database's. I moved one of my sites to a new host stepped into the MySQL Hell weird characters etc. using phpMyAdmin The collation problem will only show up if you creat a new databse and table! Click on the database you created in the left menu. This will only work if your table was created with a PRIMARY KEY. Now look on the sturcture of the database on the bottom ( MyISAM INDEXES ). See the collation is wrong, default is latin1 To change your MySQL database collation. Usually you will be interested in changing your MySQL collation in order to solve problems with foreign character encodings. One of the most common case is to change your MySQL collation from latin1 to utf8. This can be done by using phpMyAdmin and following these instructions: 1. Enter your cPanel and click on the phpMyAdmin icon in the Databases left menu. 2. Select the database you wish to manage and chage your collation for from the menu on the left, this maybe a dropdown combo box. 3. Click on the Operations tab in the top menu of your phpMyAdmin. 4. At the bottom of the page you will see the collation option. You can now select and change your database collation from the drop down menu and then click on the Go button. NOTE: you should select utf8_general_ci Please NOTE: That after you change the collation of your database, only the new tables that you create will be set to the new collation. All other tables will remain the same with the collation that they were initially created with. Most of the Web Hosts have set MySQL's collation to utf8 by default for their customers. You can also benefit from this feature. Also when you start creating your new tables you shold add this line to the bottm. CREATE TABLE IF NOT EXISTS `your_table_name` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; Use which ever database you want here, just make sure you use the CHARSET=utf8 and COLLATE=utf8_general_ci this will keep you out of MySQL Hell! If you ever need to transfer your database's. Enjoy InsiteFX |