fix encoding issue and file partial content invalid requests