ibtool fails silently when parsing certain characters in .strings files

Number:rdar://7384153 Date Originated:10-Nov-2009
Status:Open Resolved:
Product:Developer Tools Product Version:3.2 (732)
Classification:Serious Reproducible:Always
ibtool has issues with parsing certain characters. For some, it correctly stops execution and outputs an error message. But for certain ones, it appears to complete successfully, when it actually failed silently. Below is a list of characters it correctly errors out on and a list it silently fails on.

Verbal errors: " ' : . / - _ $
Silent errors: { } [ ] ; , < > ? \ | = + ! ` ~ @ # % ^ & * ( )

==Steps to Reproduce==
1) Create an Xcode project: ibtool_silent_failure.
2) Open "Get Info" on MainMenu.xib and add "fr" as a localization.
2) Generate a .strings file for English.lproj/MainMenu.xib. In Terminal, "cd" into the project directory and run "ibtool --generate-strings-file ./English.lproj/MainMenu.strings ./English.lproj/MainMenu.xib".
3) In MainMenu.strings, add a semi-colon to the end of the first entry:
/* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "5"; */
"5.title" = "Bring All to Front";;
4) In MainMenu.strings, change the window title to "new title":
/* Class = "NSWindow"; title = "ibtool_silent_failure"; ObjectID = "371"; */
"371.title" = "new title";
5) Generate a localized XIB with the above changes. In Terminal, cd into the project directory and run "ibtool --strings-file ./English.lproj/MainMenu.strings --write ./fr.lproj/MainMenu_generated.xib ./English.lproj/MainMenu.xib".

==Expected Results==
ibtool should produce a standard error saying "The stringsfile MainMenu.strings could not be parsed." Below is an error when I replaced the semi-colon (silent error) with a dollar sign (verbal error).

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
			<string>The stringsfile MainMenu.strings could not be parsed.</string>

==Actual Results==
ibtool did not return an error when executing step 5, but the resulting fr.lproj/MainMenu_generated.xib will not include the new window title. It appeared to succeed, but in fact silently failed.

I've tried this with versions 3.1.2 (677), 3.1.4 (680), and 3.2 (732). All exhibit the same problem.

I hadn't read about anyone else having this problem, until Wil Shipley touched on the issue in his blog:
"Cocoa’s localization machinery will just silently ignore all strings after any punctuation mistake, resulting in mystery partial localizations."
- http://wilshipley.com/blog/2009/10/pimp-my-code-part-17-lost-in.html

Also, plutil suffers from the same issue, so it cannot be used as a validation tool.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!