Javascript 未能执行';atob&x27;在';窗口';:要解码的字符串包含Latin1范围之外的字符

Javascript 未能执行';atob&x27;在';窗口';:要解码的字符串包含Latin1范围之外的字符,javascript,jquery,Javascript,Jquery,在这里提问之前,我看到了许多链接,但找不到有效的解决方案 目标-在Web视图中显示从Web服务接收的图像 下面是我的RESTfulWebService,它返回一个图像文件作为响应 package jersyservices.Photo; import java.io.File; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; i

在这里提问之前,我看到了许多链接,但找不到有效的解决方案

目标-在Web视图中显示从Web服务接收的图像

下面是我的RESTfulWebService,它返回一个图像文件作为响应

package jersyservices.Photo;
import java.io.File;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response.ResponseBuilder;


@Path("/sendcphoto")
public class SendCPhotoRequested {
@POST
@Path("/cphoto")
@Produces("image/jpeg") 
public File getCPhoto(@FormParam("clientid") String clientid){

     File file = new     File("C:\\Users\\nmn\\workspace1\\clientimages\\"+clientid+".jpg");
     System.out.println("File sent");
     //ResponseBuilder builder = javax.ws.rs.core.Response.ok((Object) file);
    // builder.header("Content-Disposition", "attachment; filename=clientpic.jpg");
    return file;
}
}
下面是html和js文件
$.post(“http://localhost:8080/CredentialsOnDemand/sendcphoto/cphoto", {
clientid:“111111111”,
},
函数(文件){
var byteCharacters=atob(文件);
var byteNumbers=新数组(byteCharacters.length);
for(变量i=0;i

欢迎来到我的主页
我现在是一个移动开发者

页脚文本
为什么要使用
atob
?您的Web服务似乎没有发送base64编码的数据(为什么要发送?)。去拿电话吧。@Bergi谢谢你的回答。你能解释一下我应该如何处理帖子后得到的数据吗?你为什么要使用
atob
?您的Web服务似乎没有发送base64编码的数据(为什么要发送?)。去拿电话吧。@Bergi谢谢你的回答。你能解释一下我应该如何处理我在帖子后得到的数据吗?