Microsoft translator java api的问题

Microsoft translator java api的问题,java,microsoft-translator,Java,Microsoft Translator,我在四处搜索Java的自由翻译API,我发现它很容易使用,我喜欢它,但当我从英语翻译到阿拉伯语时,我喜欢: public static void main( String[] args ) throws Exception { // Set the Client ID / Client Secret once per JVM. It is set statically and applies to all services Translate.setClientI

我在四处搜索Java的自由翻译API,我发现它很容易使用,我喜欢它,但当我从英语翻译到阿拉伯语时,我喜欢:

public static void main( String[] args ) throws Exception {       

    // Set the Client ID / Client Secret once per JVM. It is set statically and applies to all services
    Translate.setClientId("MY_CLIENT_ID_KEY");
    Translate.setClientSecret("MY_CLIENT_SECRET_KEY");

    // From English-> Arabic
    String translatedText = Translate.execute("When creating a text field component, it’s common to specify some initial text and/or a number of columns from which the field’s width is calculated.", Language.ENGLISH, Language.ARABIC);

    System.out.println(" English -> Arabic: " + translatedText);

}
我在控制台上显示为:

 English -> Arabic : ??? ????? ???? ??? ??? ?????? ?????? ??? ???? ??????? ?/?? ??? ?? ??????? ???? ?? ?????? ??? ???? ????? ?????.

我不知道如何修复此错误,以便在控制台上获得一些有意义的完整字符,而不是上面的字符。

您必须将控制台的编码更改为
UTF-8
,然后阿拉伯字符将正确显示。
如果您使用的是eclipse,请执行以下步骤:

步骤1: 单击运行-->运行配置

步骤2: 单击公共选项卡->选择其他->将编码更改为UTF-8

步骤3:
单击应用,现在可以在控制台上打印阿拉伯语文本。

您的控制台显示错误的代码页或字体。这与Java或您的代码无关。好吧,但当我在JSP页面中显示它时,我也会得到相同的字符!!!您可能正在使用错误的编码提供页面。检查浏览器中的“编码”菜单。谢谢!在JSP中,我已经解决了这个问题,但如何在控制台中解决这个问题,请提供任何帮助:-(