Why is row id interpreted as � |
Hi ,
I am converting an existing project to Ci4. but when I get data from the database all the row id's are displayed as � example PHP Code: <select id="salutation" class="form-control"> Code: <select id="salutation" class="form-control"> MY configuration is as follows app/config/Database.php public $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => 'xxxxxxx', 'password' => 'xxxxxxx', 'database' => 'xxxxxxx', 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => (ENVIRONMENT !== 'production'), 'cacheOn' => false, 'cacheDir' => '', 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', 'encrypt' => false, 'compress' => false, 'strictOn' => false, 'failover' => [], 'port' => 3306, ]; My Table Charset utf8 Collation utf8_general_ci php.ini default_charset = "UTF-8" html doc Code: <!doctype html> I've never had this problem before Ci4 and can't for the life of me figure out what is going on. Any suggestions ??? Many thanks
On further investigation. I have found that single INT chars 1 - 9 output � 01, 02, 03 .. 11, 12, 13 etc do run into this problem.
I have also tested on Firefox, IE and Edge and INT chars 1 - 9 output � in all instances. Again, I have only seen this issue since using Ci4. Thank you.
After much soul searching and google searching, I do not believe single character data is "liked", and seems to cause more trouble than it's are worth. In addition, I have found Ci4 prepared queries (this may not be limited to Ci4)do not like working with single character data, for example when trying to insert data that is a single character, the error "Uninitialized string offset: 1" is returned.
Therefore to overcome this specific issue on the Ci4 framework, my table auto increment id's now start from 10 rather than 1. Also, I do not store single character data (y,n or a,b,c or 1,2). Maybe the practices I deployed in the past were bad practices or things have just moved on, still this works for me. (06-16-2020, 07:30 AM)68thorby68 Wrote: After much soul searching and google searching, I do not believe single character data is "liked", and seems to cause more trouble than it's are worth. In addition, I have found Ci4 prepared queries (this may not be limited to Ci4)do not like working with single character data, for example when trying to insert data that is a single character, the error "Uninitialized string offset: 1" is returned. Try to open any file with an editor, notepad ++ or even notepad, and check the code of the file, as in the attached image. |
Welcome Guest, Not a member yet? Register Sign In |