4 ms·
"Want to ensure tweets aren’t longer than 140 characters, make sure you set your tweet column to varchar(140) and not to text." This is fine if all your users
by peterburkimsher 9y ago
"Want to ensure tweets aren’t longer than 140 characters, make sure you set your tweet column to varchar(140) and not to text."
This is fine if all your users are content with ASCII. As soon as double-width characters from Chinese or emoji start interfering, the database will limit some users to 70 characters. It's ok to make restrictions, but be sure to fully understand how they'll affect your users.
- chronid 9y agoIn PostgreSQL varchar uses actual characters (as specified by the database character encoding), not bytes, IIRC. The same thing should be true for (at least recent versions of) MySQL.