hi Team
during our project we met the Chinese character problem in processing
the download/upload google doc
the issue is that when I use google GData api to download a doc files
which has Chinese character or upload a txt file with Chinese
character ,the files are downloaded/uploaded successful but the
Chinese character is all garbled
this is core code of our project ,use the standand GData API and
DocumentList.java Utility:
download process:
service = this.service;
String[] parameters = {"docID=" + id, "exportFormat=" + format};
url = buildUrl(URL_DOWNLOAD + "/" + docType + "s" +
URL_CATEGORY_EXPORT, parameters);
}
InputStream inStream = null;
FileOutputStream outStream = null;
try {
Link link = new Link();
link.setHref(url.toString());
inStream = service.getStreamFromLink(link);
outStream = new FileOutputStream(filepath);
byte[] tmp = new byte[1024];
int len=0;
while ((len=(inStream.read(tmp))) != -1) {
outStream.write(tmp,0,len);
}
}
upload process:
public DocumentListEntry uploadFile(String filepath, String title)
throws IOException,
ServiceException, DocumentListException {
if (filepath == null || title == null) {
throw new DocumentListException("null passed in for required
parameters");
}
URL url = buildUrl(URL_GROUP_DOCUMENTS + URL_PATH);
DocumentEntry newDocument = new DocumentEntry();
File documentFile = new File(filepath);
newDocument.setFile(documentFile);
newDocument.setTitle(new PlainTextConstruct(title));
return service.insert(url, newDocument);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---