我正在尝试使用谷歌电子表格 api 阅读电子表格。一切都很顺利,但是当我将俄语或阿拉伯语文本放入电子表格时,我的程序会打印???????? ???这些单元格值的值。下面是从我的谷歌帐户读取电子表格的代码。
SpreadsheetService service = new SpreadsheetService("MyApp");
service.setUserCredentials(USERNAME, PASSWORD);
URL feedUri = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full?title-exact=true&title=internationalization_contents");
// Make a request to the API and get all spreadsheets.
SpreadsheetFeed feed = service.getFeed(feedUri, SpreadsheetFeed.class);
List<SpreadsheetEntry> spreadsheets = feed.getEntries();
SpreadsheetEntry spreadsheet = spreadsheets.get(0);
// get the first work sheet
WorksheetEntry workSheet = spreadsheet.getWorksheets().get(0);
URL cellFeedUrl = workSheet.getCellFeedUrl();
CellFeed cellFeed = service.getFeed(cellFeedUrl, CellFeed.class);
List<CellEntry> entries = cellFeed.getEntries();
for (int n = 0; n < entries.size(); n++) {
Cell cell = entries.get(n).getCell();
System.out.println(cell.getValue());
}
这打印出类似的东西
欢迎标题????? ???
任何人都知道如何正确地将字符输入到我的 java 应用程序中。