added encoding support