Capture words with accent with Scanner

4

I'm using a Scanner, in Java, to capture Words / Phrases; however when I type a word that contains accented or 'ç', the letter becomes a 'square'!

    
asked by anonymous 15.04.2015 / 00:24

1 answer

5

When instantiating your Scanner you can tell charset " you want to use. So consider using something like this:

Scanner sc = new Scanner(System.in, "UTF-8");

The above line is an example, you should enter the charset you need such as the gifts here .

    
15.04.2015 / 00:32