CharacterSet mismatch |
We are trying to migrate to PHP 7 which involves changing the driver for the database to sqlsrv as opposed to mssql. Here is what the configuration for the database looks like:
PHP Code: $db['default']['hostname'] = '192.168.3.55,53627'; The problem is that all characters that are beyond the ASCII character set display as gibberish. With PHP 5 and the mssql driver there was an option to set the character set to 'windows-1252'. But this does not seem to be an option any more. what should the character set be? setting the character set (char_set) to 'utf8' makes it so that there are no database errors but characters are not translated correctly.
The new character sets for unicode databases are defaulting to.
CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci You may need to alter your database and tables to change to a new character set and collation. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
09-14-2017, 06:03 AM
(This post was last modified: 09-14-2017, 06:13 AM by rkb. Edit Reason: Include more information ) (09-14-2017, 03:43 AM)InsiteFX Wrote: The new character sets for unicode databases are defaulting to. So in essence you are saying that the charset 'windows-1252' is no longer a supported database character set. I tried those settings PHP Code: $db['default']['dbcollat'] = 'utf8mb4_unicode_ci'; and I got: Code: <html> These don't seem to be valid options.
windows-1252' is not a database character set it is a Windows browser and html character set.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-14-2017, 08:59 AM)InsiteFX Wrote: windows-1252' is not a database character set it is a Windows browser and html character set. Semantics. Is all I know is that with PHP 5.x and the mssql driver I used to be able to specify 'windows-1252' as the database character set in the configuration for the database with CodeIgniter. Now (with PHP 7.x and sqlsrv driver) the database configuration for CodeIgniter no longer accepts (throws a database exception) 'windows-1252' as an option. Specifying 'windows-1252' as the database charset configuration worked before. For CodeIgniter with a sqlsrv driver this isn't a valid option. If we want to migrate to PHP 7.x with CodeIgniter I am only asking what the database configuration charset should be to mimic the "old" behavior (with PHP 5.x and mssql driver)? (09-14-2017, 03:43 AM)InsiteFX Wrote: The new character sets for unicode databases are defaulting to. Nobody asked anything about Unicode or UTF-8. And you're talking about MySQL on a Microsoft SQL Server issue. (09-14-2017, 08:59 AM)InsiteFX Wrote: windows-1252' is not a database character set it is a Windows browser and html character set. BS. A character set is a character set. (09-14-2017, 10:57 AM)rkb Wrote:(09-14-2017, 08:59 AM)InsiteFX Wrote: windows-1252' is not a database character set it is a Windows browser and html character set. Pretty sure I wrote a reply yesterday ... maybe I forgot to actually hit the Post button. Read this: https://blogs.msdn.microsoft.com/brian_s...racterset/ SQLSRV_ENC_CHAR is also the default in CI if you don't specify a charset in the config.
I read the link you sent (Thank you!) but it didn't say anything about 'windows-1252' Please explain why the character set specified in the database configuration for CodeIgniter 'windows-1252' worked before (PHP 5.X) and now is no longer an option.
If you actually read the link, you'd know why it doesn't mention windows-1251, cp1251, etc.
|
Welcome Guest, Not a member yet? Register Sign In |