Converting or fixing MySql table character set

Recently I had to migrate some very old website to a new server. When that website was first deployed the MySql server was at version 4.0 and had no internal support for character sets. When MySql 4.1 first appeared and assigned each table and column their own character set it was very common for applications to store data with different actual encoding than the meta data specified in the database schema.

This led to problems during data migrations and also when browsing database with clients that specify their connection encoding. Whenever a connection encoding different than default (latin1) was specified MySql would try to convert the table contents to the requested coding and fail miserably if the data real encoding was different than what was stored in table definition. In my case I was storing utf8 data while MySql was convinced it was latin1. When in a situation like this you have two options. Read more...

Trigger AdWords conversion on javascript event

When creating ChoiceVoice we wanted to greatly simplify the standard order process. Wojtek decided to fit it all on single page powered by Ajax. This worked out great, but at the end of the implementation we faced a minor problem. Google’s Adwords don’t support programmatic conversion tracking. With the snippet provided by google the user triggers conversion by navigating to a site – like a “Thank you for your order” page. This of course couldn’t work for us, because our clients are taken to paypal immediately after filling out the form. Read more...

Soft hyphen and in-page search in different browsers

When creating my main page I wanted to hyphenate words in some places. This can be especially useful when putting content in narrow, justified columns. Unfortunately this rather rudimentary technique in paper media is rarely seen on the web. Currently the best way to break words on your web page is to manually1 add the soft-hyphen characters to your text. Soft hyphen in html is encoded with a ­ entity.

Fortunately, unlike how some posts dated a few years back describe it, this entity now displays properly in all modern browsers. Properly means that ­ displays a hyphen when there is a need to break a word, but doesn’t display anything when the word fits the line. Let me show you an example. Read more...