added encoding to controllers.