Delete Your Code #7: Right encoding
db, delete your code, development, encoding, mysql, php, server No Comments »You might be surprised, but a right choise of the project text encoding can affect the project file size and amount of bugs.
To avoid bugs of wrong presentation of text on your page, make sure that all database entities and the application server (PHP) use the same encoding. That helps to forget about issues connected with text presentation.

On database side, make sure you set the correct encoding to:
- database,
- tables,
- columns,
- import-export tools parameters (a big source of wrong encoding bugs),
- corresponding SQL server variables
On application server it’s usually just one query –
SET NAMES utf8
Pay attention, that utf8 might be not the best choise for your project: every non-English character needs 2-6 bytes of memory, so if you built a one-language (local) project with lots of database data, consider using a 1 byte encoding like windows-1251 and save about half of the space on server file system.
All of web applications I’ve built have an admin panel. Usually, that panel is a system to manage items: add a product, disable a user, delete a message.
To start with, it’s a watch dog of your database integrity — for example, it would be impossible to add user images records, if the user does not exist. No additional code, more control.
Of course, all of us use some terms — this rule is to use a well defined set of terms and to avoid synonyms.
Have you ever thought why it takes 5-15 minutes to get into the flow? From my point of view, that’s because you have to understand the root of a task, to load its code base into your operating memory – brain. So the less code you have to deal with, the more productive you are in juggling with it.
Recent Comments