Skip to content

Commit 9999a95

Browse files
authored
Update Troubleshooting_encoding.md (#1082)
* Update Troubleshooting_encoding.md I think we can use some html tags to show the picture caption in a more fancy way.
1 parent eaf7def commit 9999a95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: Troubleshooting_encoding.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ C:\Test>java -Dfile.encoding=UTF-8 -cp ./Exercises Hello
5858

5959
## 3.Troubleshooting Suggestions
6060
The following diagram shows the parts of encoding that may be involved when writing and running Java in VS Code.
61-
![encoding_diagram](https://user-images.githubusercontent.com/14052197/142807897-201231d7-e4b1-4534-a75f-31d61b54cdc0.png)
61+
<p align="center">
62+
<img alt="encoding_diagram" src="https://user-images.githubusercontent.com/14052197/142844414-360765c9-8e7d-4825-a5b9-7360c624fa8d.png">
63+
<br>
64+
<em>Encoding on Windows</em>
65+
</p>
6266

6367
- During the compilation phase, VS Code Java extension uses the file encoding from VS Code settings to read .java source files and compile .class files. Encoding is consistent between editor and Java extension.
6468

@@ -73,4 +77,8 @@ To solve the encoding problems, the straightforward idea is to use UTF-8 in all
7377
On Windows, when you change the system locale, the default Java charset will be changed to one compatible with the system locale, and the terminal's (e.g. cmd) code page will be automatically updated to be consistent as well. Therefore, changing system locale to the target language can solve most encoding issues on Windows. This is also suggested by Java site https://www.java.com/en/download/help/locale.html.
7478

7579
The following screenshot shows how to change the system locale in Windows. for example, if I want to use a terminal to enter Chinese characters into a Java program, I can set the Windows system locale to Chinese. The default Java charset will be `"GBK"` and the cmd codepage will be `"936"`, which will support Chinese characters nicely.
76-
![image](https://user-images.githubusercontent.com/14052197/138408027-da71d3f4-7f64-4bfb-8b34-89d0605606f5.png)
80+
<p align="center">
81+
<img alt="change_system_locale" src="https://user-images.githubusercontent.com/14052197/138408027-da71d3f4-7f64-4bfb-8b34-89d0605606f5.png">
82+
<br>
83+
<em>Change System Locale</em>
84+
</p>

0 commit comments

Comments
 (0)