如何String
从波兰字母中获取JTextField
或JTextArea
使用波兰字母?当我使用myTxtArea.getText()
并且在我的JTextArea
我得到ĄĆĘŁŃÓŚŹŻąćęłńóśźż
它时,它只识别?????Ó????????ó???
.
JTextField
两者的文本都JTextArea
将保存在 *.txt 文件中
那是我的代码:
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MyAppCreateAcc {
public static void main(String[] args) throws IOException {
AppGUI ag = new AppGUI();
}
public MyAppCreateAcc() throws IOException {
String group = AppGUI.getGroup().getText();
String[] lines = AppGUI.getNote().getText().split("\\n");
BufferedWriter w = new BufferedWriter(new FileWriter(
"zaloz_konta.cmd"));
w.write("mode con codepage select=1250");
w.newLine();
for (int j = 0; j < lines.length; j++) {
/*
* delete more than one space between words and from the full name
* create a short one first letter of name and surname after all
* lowercase like on example: John Smith = jsmith
*/
if (lines[j] == null || lines[j].equals("")) {
// if there is a gap between the names do nothing
} else {
lines[j] = lines[j].trim().replaceAll(" +", " ");
Pattern pattern = Pattern.compile("\\s([A-Za-z]+)");
Matcher matcher = pattern.matcher(lines[j]);
String shortName = "";
if (matcher.find()) {
shortName = (lines[j].charAt(0) + matcher.group(1))
.toLowerCase();
}
w.write("call konto.cmd " + shortName + " \"" + lines[j]
+ "\" 123 " + "\"" + group + "\"");
w.newLine();
}
}
w.close();
}
}
我想从以下地址获取波兰语信件:
String[] lines = AppGUI.getNote().getText().split("\\n");