bugfix: python 2.6.x encode() function doesn't take keyword arguments.