Add encoding declaration
Log errors