IBM Watson Assistant - umlauts

问题描述 投票:0回答:1

最近,我尝试使用IBM的Watson文本助手。我选择用Java来编程,一切都很正常,直到我尝试使用德语短语,其中使用umlauts[ä,ö,ü]。

技能语言也是德语。

当收到API的响应时,所有的umlauts都被替换成了 "ä"。

这就是代码。

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();
}

你知道有什么方法可以正确地从IBM的API中获取umlauts吗?

java ibm-cloud ibm-watson
1个回答
1
投票

在我的例子中,这一行做到了。(感谢@data_henrik)

System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "UTF-8"));
© www.soinside.com 2019 - 2024. All rights reserved.