Eclipse character encoding

前端 未结 2 718
暗喜
暗喜 2020-12-06 05:44

I am using Scanner to scan a .txt document in Java. However, when I open the .txt document in Eclipse, I notice some characters are not being recognized, and they are repla

相关标签:
2条回答
  • 2020-12-06 06:17

    If you need to change the character encoding for your entire Eclipse Workspace, go to Window -> Preferences. Then under General -> Workspace, change the 'Text file encoding' to the appropriate character encoding (in this case, UTF-8).

    Eclipse Preferences - Changing Character Encoding

    0 讨论(0)
  • 2020-12-06 06:24

    The file you are reading must be containing UTF-8 or some other encoding characters and when you try to print them on console then you will get some characters as �'. This is because the default console encoding is not UTF-8 in eclipse. You need to set it by going to Run Configuration -> Common -> Encoding -> Select UTF-8 from the drop down. Check below screenshot:

    enter image description here

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