Fix handlebar.py when template and input isn't unicode

Now handlebar will not crash when using not unicode Chinese character as template or input.
Add an unicode check/convert in constructor and _resolveFromContext.
Now it need input and template using utf-8 if it isn't pure English content.
This commit also use built-in 'list' function replace the for loop.This may improve performance.