Feb 28
It’s was entertaining to dig into email address format while working on a corresponding task.
Here are a few facts that I didn’t expect to be allowed for email address:
- the local part of an email address can contain spaces, and it must be quoted and escaped by a back slash like “\ “
- the local part of an email address can contain comments! It’s put in parentheses and can be omitted. Example: “john(comment).smith@example.com” equals to “john.smith@example.com“
- domain part can have IP instead of domain. To do that, it must be put in square braces like “john@[192.168.1.1]“
Here are examples of VALID email addresses:
- '@[10.10.10.10]
- user@[IPv6:2001:db8:1ff::a0b:dbd0]
- "much.more\ unusual"@example.com
- "very.unusual.@.unusual.com"@example.com
- "very.(),:;<>[]\".VERY.\"very@\\\ \"very\".unusual"@strange.example.com
- 0@a
- !#$%&'*+-/=?^_`{}|~@example.org
- "()<>[]:;@,\\\"!#$%&'*+-/=?^_`{}|\ \ \ \ \ ~\ \ \ \ \ \ \ ?\ \ \ \ \ \ \ \ \ \ \ \ ^_`{}|~.a"@example.org
- ""@example.org
Feb 03
Funny, but indexOf method doesn’t work in an empty array in Internet Explorer, the method is just not defined. Eh!
Forget about that and always use jQuery wrapper –
$.inArray(42, [31, 42, 53]);
Feb 02
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.
Recent Comments