Unicode characters (Arabic letters) show up as question marks in IDE console

后端 未结 2 1484
情歌与酒
情歌与酒 2020-12-07 03:42

I am using JSF 2.0 and I have text field as


    
    

        
相关标签:
2条回答
  • 2020-12-07 04:28

    If the data comes from a DB, please check the field datatype is nvarchar.

    0 讨论(0)
  • 2020-12-07 04:30

    This is caused by using the wrong console encoding.

    The line

    System.out.println("My Data is " + fullName);
    

    prints to the standard output (stdout). You need to configure it to use UTF-8 as well. Assuming that you're using Eclipse, then you need to change the stdout encoding to UTF-8 by Window > Preferences > General > Workspace > Text File Encoding.

    enter image description here

    If you're using Netbeans, which I can't answer from top of head, head to this answer: hebrew appears as question marks in netbeans which contains a link to this Netbeans Wiki which mentions the following:

    To change the language encoding for a project:

    1. Right-click a project node in the Projects windows and choose Properties.
    2. Under Sources, select an encoding value from the Encoding drop-down field.

    See also:

    • Unicode - How to get the characters right?

    Unrelated to the concrete problem, those lines in the filter are unnecessary

        res.setCharacterEncoding("UTF-8");
        res.setContentType("text/html;charset=utf-8");
    

    They defaults in case of JSF2/Facelets to proper values already. Remove those lines.

    0 讨论(0)
提交回复
热议问题