[英]IBM Watson Assistant - umlauts
Recently, I tried to work with IBM's Watson text assistant.最近,我尝试使用 IBM 的 Watson 文本助手。 I chose to program it with Java and everything worked alright until I tried to use German phrases, which use umlauts [ä, ö, ü].
我选择使用 Java 对其进行编程,一切正常,直到我尝试使用使用变音符号 [ä, ö, ü] 的德语短语。
The skill language is also German.技能语言也是德语。
When receiving a response from the API, all umlauts where replaced by �.当收到来自 API 的响应时,所有变音符号都替换为 �。
Here's the code:这是代码:
public String inquiry(String anfrage){
MessageInput input = new MessageInput();
input.setText(anfrage);
MessageOptions options = new MessageOptions.Builder(WORKSPACEID)
.input(input)
.build();
MessageResponse response = assistant.message(options)
.execute()
.getResult();
return response.getOutput().getGeneric().get(0).text();
}
Do you know a way to properly get umlauts from the IBM API?您知道从 IBM API 正确获取变音符号的方法吗?
This line did it in my case.这条线在我的情况下做到了。 (Thanks to @data_henrik)
(感谢@data_henrik)
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "UTF-8"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.