优化文本编码识别

This commit is contained in:
许轲 2023-08-10 14:06:05 +08:00
parent e693e7ad11
commit 30674fceb1
3 changed files with 4 additions and 1 deletions

2
.idea/encodings.xml generated
View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/aaa.txt" charset="GBK" />
<file url="file://$PROJECT_DIR$/init.bat" charset="US-ASCII" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/新建文本.txt" charset="GBK" />

View File

@ -124,7 +124,6 @@ public class JNotepad extends Application {
tabPane.getSelectionModel().select(tab);
updateStatusLabel(textArea);
// 更新编码信息
//updateEncodingLabel(newValue);
updateEncodingLabel(textArea.getText()); // 更新文本编码信息
}
}
@ -138,6 +137,7 @@ public class JNotepad extends Application {
if (file != null) {
try {
getTXT(file);
updateEncodingLabel(((TextArea) tabPane.getSelectionModel().getSelectedItem().getContent()).getText()); // 更新文本编码信息
} catch (IOException e) {
e.printStackTrace();
}
@ -242,6 +242,7 @@ public class JNotepad extends Application {
try {
a = false;
getTXT(file);// 读取文件
updateEncodingLabel(((TextArea) tabPane.getSelectionModel().getSelectedItem().getContent()).getText()); // 更新文本编码信息
} catch (IOException e) {
e.printStackTrace();
}