Sorry for my initial posting of this .... ran right over your paragraph stating you had tried this.
Sorry for my initial posting of this .... ran right over your paragraph stating you had tried this. You can create the InputStreamReader with a charset of "UTF-8" which will automatically convert the input data into the correct characters for you. While ((ze = zin.getNextEntry())!
= null) { Log. V("Decompress", "Unzipping " + ze.getName()); if(ze.isDirectory()) { _dirChecker(ze.getName()); } else { if (ze.getName() == desiredFile) { byte bytes= new byteze.getSize(); zin. Read(bytes, 0, bytes.
Length); strUnzipped= new String( bytes, "UTF-8" ); /* Removing this as it is easier to just read all the bytes in at once InputStreamReader isr= new InputStreamReader(zin, "UTF-8"); char c= 0; for (char c = isr.read(); c! = -1; c = isr.read()) { strUnzipped += c; } */ } zin.closeEntry(); } } Please try the above and see how it works out.
Thanks for the answer. I tried it and Eclipse says "cannot convert from int to char" and it suggests the following correction: "for (char c = (char) isr.read(); c! = -1; c = (char) isr.read()) {".
But when compiled it crashes the emulator! – Daniel Jul 20 at 17:45 Sorry I had forgotten that the read returns an "int". As for the crash, that's REALLY odd!
I would try cleaning out your project (Projects > Clean) code base and restarting the emulator then re-deploy your application to the emulator. If this is still giving you problems, hit me up again with a comment. – Dave G Jul 20 at 19:22 Actually I think I see the problem with my suggested read loop.
Give me a minute to track down the correct way to do this. – Dave G Jul 20 at 19:24 I made a change to the loop basically removing it. But this should work better.As a sanity check you may want to tweak the zin.read() line to check to make sure you've read the correct amount of bytes.
– Dave G Jul 20 at 19:32 It worked! Thanks for helping.In spite of I need to add a "(int)" in the line: byte bytes = new byte(int) ze.getSize();. Is that safe?
I added a sanity check above, is that what you meant? – Daniel Jul 20 at 21:49.
StringBuilder sb = new StringBuilder(); for (int c = zin.read(); c! = -1; c = zin.read()) { sb. Append((byte)c); } ... return sb.toString().
Thanks for the answer. The result string showed UTF-8 values again. How could I load the integer variable "c" into a byte array?
Valeu conterrâneo! – Daniel Jul 20 at 17:49 sorry, just replace (byte) for (char), it's a typo :( – molusco Jul 20 at 21:49.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.