我有一个以 ISO-8859-1 编码接收参数的 Web 服务。
但是当我尝试从请求中读取它时,我得到了这个字符:
����</p>
我已经尝试了所有这些方法,但是没有一个将给定的字符串转换为预期的字符串(áéíóú):
val a = new String(_html.getBytes());
val b = new String(_html.getBytes(), "UTF-8")
val c = new String(_html.getBytes(), "ISO-8859-1")
val d = new String(_html.getBytes("ISO-8859-1"), "UTF-8")
val e = new String(_html.getBytes("ISO-8859-1"), "ISO-8859-1")
val f = new String(_html.getBytes("UTF-8"), "UTF-8")
val g = new String(_html.getBytes("UTF-8"), "ISO-8859-1")
这是我的行动:
val inboundMessageForm = Form(
mapping(
"html" -> text)(InboundMessage.apply)(InboundMessage.unapply))
def forward = Action(parse.multipartFormData) { implicit request =>
val inboundMessage = inboundMessageForm.bindFromRequest.get
// inboundMessage.html => �����
}
我能做些什么来解决这个问题?