Wp foreign characters, Php, Creating Tables

I knocked myself around trying to figure out why my plugin was not coping with ‘foreign’, multi byte, Greek, Japanese, Chinese characters.  Those damn questions marks ‘????’ – I had it all sorted before in another plugin – what was going on here ?   I had all the multi-byte functions happening.    Then I remembered – the database tables – of course!

Default Mysql

MySQL’s default database charset is usually latin1 and  thecollation is latin1_swedish_ci.  This can vary based on server configuration.  This is usually set before wordpress is installed.

Default wordpress

WordPress usually creates it’s table with charset utf8 and collation utf8_general_ci.    You can overwrite this in the config file.

See http://codex.wordpress.org/Editing_wp-config.php#Database_character_set.

Fix your wordpress database

You can Alter the database after the fact.  This will help the plugins who haven’t figured out that many of us (you?) haven’t set up our databases as well as they could be.

ALTER DATABASE yourdb CHARACTER SET utf8 COLLATE utf8_general_ci;

You may want to fix the individual tables and fields too – phpmyadmin has the tools to edit (or use the rename – it will let you change the collation).

Plugin authors

Make life easy on your self and others when creating custom tables.  Have a look at the wordpress db schema.  Note that there is a global $charset_collate.  Use it!


 global $wpdb, $charset_collate;
if (empty($charset_collate))
    $cachecollation = ' DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ';
    $cachecollation = $charset_collate;

if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
 $sql = "CREATE TABLE " . $table_name . " (
 field1 text NOT NULL,
 field2 text NOT NULL,
 ".$cachecollation. ";";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
 error_log($table_name.' not created');
 return false;
 else return true;






Comparison of Event Calendar Plug-ins

A quick look in no particular order (except mine first of course) .  Yes I am checking out the competition – I love developing, but need to get some return on it.  Hence some research on what others are doing.

Update as at: Feb 2012


  • free at wordpress (4 star rating, 2012 updates)
  • input via  ics file subscription
  • most customisable calendars, agendas, schedules etc, variety of views
  • date navigation and pagination
  • widgets


  • paid addon to the above ($40)
  • full event creation, custom post types, taxonomies, locations
  • filtering
  • filters, pluggable functions
  • variety of map plugin integrations
  • multi lingual integration
  • produce ics feeds
  • uses wordpress as intended so you get benefits of being able to integrate other plugins

event espresso ($$$!)

  • lite version at wordpress (3 star rating)
  • paid version not cheap (lots of addons – top price $500, base at $90)
  • registration, ticketing, payment gateways
  • recurring events an addon

all in one event calendar

  • free version at wordpress (5 star rating, 2012 update)
  • is it error prone? (7 brokens for last version, but 13 works)
  • paid support at $120 hour
  • recurring, ics import/export, variety of views, widgets

events manager

  • free version at wordpress (4 star rating, last update 2010/10)
  • paid version $75
  • bookings, paypal
  • free version at wordpress (4 star rating, last update 2012)
  • sounds fairly full featured, views, recurring, customisable
  • user guide at $20
  • free at wordpress (4 star, but last update 2010)

events calendar

  • free version at wordpress (3 star)
  • create and present calendar for events
  • free version at wordpress (3 star, last 2009)
  • event registration



WordPress.com or self-hosted wordpress

Looking to set up a website using WordPress, one of the world most popular content management systems?

Assess your skills (ftp, html, css, php) and what you are prepared to do yourself, and how good you are at educatng yourself using the web.  Then consider your options.

WordPress.com PROS

  • easy to get going even if no skills
  • free, or can add premium feaures (they add up)
    • videopress ($60/year)
    • custom css for own styling or tweaks ($30/year)
    • post or moderate using your phone (usa only)
  • can map your existing  domain there ($12/year), or register a domain through them($17/year)
  • they’ll keep you up to date with wordpress at least.
  • language aspects are pre-loaded
  • if you want to allow comments, wordpress.com has good antispam built in, althoiugh you can also add that feature (akismet) in to a self hosted site.
  • you’re hosted by wordpress.com – so you are on a server where all the sites are running wordpress

WordPress.com CONS

  • limited to their themes, although premium themes available ($45)
  • totally reliant on them – if they disappear, so do you (unless you have figured out a way to keep own backup of your site and can arrange hosting, reload of site and repoint your domain name.  That said, this is what you would have todo on a self hosted site anyway.
  • cannot display ads, unless you revenue share advertising (high volume clients only)
  • have to pay extra NOT to have ads ($29.97)

Self Hosted WordPress PROS

  • Total control (along with that comes the requirement that you be able to manage that control)
    • own themes, plugins
    • customise functionality and style as you like
  • Cheap if you have the skills! Good wordpress hosting is available from $72/month

Self Hosted WordPress CONS

  • You need to purchase your own domain name and web hosting
  • If you don’t know what you are doing, you either need to hire some one or you will get into trouble.
  • Have to do/arrange WordPress upgradesm plugin and theme upgrades
  • Hiring people can get expensive
  • Have to add in what comes automatically at wordpress.com.
    • add in askimet anti-spam
    • add in own backups to your own pc (your host should do backups, but you should also have your own)
    • spikes in traffic may be a problem
  • With shared hosting (own server costs approximately $200/month), you are sharing the server – this reduce costs but if the other guys are up to no good…. That said a good wordpress host will normally switch servers for your promptly if you suspect a problem.

 More Information

What to do:


  • your skill levels
  • website requirements and it’s implications (eg:membership, comments – you need anti-spam)
  • how much you are prepared to pay for someone to assist you if you need assistance.

It is free to open a wordpress.com site, so give it a go – you’ll need it anyway if you want to use their anti-spam service askimet, or the wordpress.com stats via the jetpack plugin.

If you are comfortable with doing many things yourself or are prepared to hire the skills you need, and know how to test your website and any plugins you add, consider going with a self hosted solution.  You can either do it yourself – there are heaps of guides out there.

If you want to get going quickly, I can have you up and running within a day if you use icdsoft as your host