vietjet / iphonefrotz

Automatically exported from code.google.com/p/iphonefrotz
Other
0 stars 0 forks source link

iPhone Frotz decodes iFiction Files from blorbs as Latin-1 instead of UTF-8 #227

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Trying to open a zblorb with umlauts in the description shows incorrect 
symols.
2.
3.

What is the expected output or behavior?  What do you see instead?
Expected: correctly decoded UTF-8 special characters in description of blorb 
file
instead: incorrectly decoded characters

What version of Frotz are you using?
1.6

What device model are you using (e.g., iPhone 5, iPhone 3GS, iPad 4, iPod
Touch 4th gen.)
iPhone 4S

What version of iOS?  6.1, 7.0, etc.)
6.3

Please provide any additional information below.
Special characters in iFiction files saved with Western (Windows 1252) encoding 
are shown correctly in iPhone Frotz.
The Treaty of Babel says iFiction files are to be encoded in UTF-8.
David Kinder kindle analysed this problem.

Original issue reported on code.google.com by IMSGmis...@gmail.com on 31 Dec 2013 at 12:49

GoogleCodeExporter commented 9 years ago
For more background, see the discussion starting at 
http://www.intfiction.org/forum/viewtopic.php?f=18&t=6349#p64026

The problems seen turned out to revolve around the encoding of the iFiction XML 
file inside the Blorb file. The Treaty of Babel says that this must always be 
encoded as UTF-8 (see http://babel.ifarchive.org/babel_rev7.txt at section 5.2) 
but iFrotz seems to always interpret it as ISO-Latin-1. These encodings are the 
same for all ASCII characters, but not for other things, such as accented 
characters.

At a guess, after looking through the source code, the problem is in 
src/iphone/ui_utils.m, in metaDataFromBlorb(). This contains the line

NSString *xmlString = [NSString stringWithCString: buf 
encoding:NSISOLatin1StringEncoding];

which declares the string that the XML is copied into - it might be sufficient 
to change this to 

NSString *xmlString = [NSString stringWithCString: buf 
encoding:NSUTF8StringEncoding];

to fix the problem.

Original comment by dav...@davidkinder.co.uk on 31 Dec 2013 at 12:59

GoogleCodeExporter commented 9 years ago

Original comment by spath...@gmail.com on 12 Jun 2014 at 1:46

GoogleCodeExporter commented 9 years ago
David, thanks for the suggestion.  This looks like the right fix to me.
Unfortunately, I couldn't seem to find a link in the discussions to an actual 
blorb file which exhibits the problem to test it.

Original comment by spath...@gmail.com on 12 Jun 2014 at 1:50

GoogleCodeExporter commented 9 years ago
For a zBlorb using umlauts please see:
http://textpaeckchen.org/downloads/wasser-hasser/Wasser-Hasser.zblorb

Original comment by IMSGmis...@gmail.com on 12 Jun 2014 at 4:59

GoogleCodeExporter commented 9 years ago

Original comment by spath...@gmail.com on 14 Aug 2014 at 7:48

GoogleCodeExporter commented 9 years ago
Fixed in release 1.7, now available (as soon as App Store servers update).

Original comment by spath...@gmail.com on 22 Aug 2014 at 4:21