OK. I figured it out after thinking more about what you said in your
item 3. I need to convert the bytes that come out of the zip file into
correct unicode. I changed the method as follows, and now it renders
the characters properly:
private boolean readEpubFile() {
FileInputStream f = null;
ZipInputStream z = null;
byte[] buffer = new byte[65536];
try {
f = new FileInputStream(this.file);
z = new ZipInputStream(f);
ZipEntry ze;
while ((ze = z.getNextEntry()) != null) {
StringBuilder sb = new StringBuilder();
int totlen = 0;
int len = 0;
while ((len = z.read(buffer)) > 0) {
sb.append(new String(buffer, 0, len, "UTF-8"));
totlen += len;
}
String name = ze.getName();
if (this.itemMap == null) {
this.itemMap = new LinkedHashMap<String,
String>();
}
this.itemMap.put(name, sb.toString());
}
}
catch (Throwable t) {
return (false);
}
finally {
try {
z.close();
}
catch (Throwable t) {
}
try {
f.close();
}
catch (Throwable t) {
}
}
return (true);
}
Thanks again to all of you for your help.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en