Xcode 9 Localization export/import improperly handles quotation marks

Originator:srossillo
Number:rdar://41252283 Date Originated:2018-06-19
Status:Open Resolved:
Product:Xcode Product Version:9.4.1 (9F2000)
Classification:Bug Reproducible:Always
 
Summary:
Xcode export for localization leaks strings file encoding into XLIFF. Furthermore, importing localizations in Xcode with targets container bare quotes corrupts the strings file.

Steps to Reproduce:
1. Create a string in code
    NSLocalizedString("There is a \" in my string", comment: "string with quote");
2. Export for localization and open en.xliff
3. Note the exported string contains a escaped quote where it should just be a standalone quote mark.
4. In Xcode, import a localized XLIFF (see attached). That contains either a bare quote or an XML encoded quote.
5. es.lproj/Localizable.strings is now corrupt (contains an unescaped quote in the string value.


Expected Results:
Export:
<source>There is a " in my string</source>

Import:
/* string with quote */
"There is a \" in my string" = "hay una \" en mi cadena";

Actual Results:
Export:
<source>There is a \" in my string</source>

Import:
/* string with quote */
"There is a \" in my string" = "hay una " en mi cadena";

Version/Build:
Version 9.4.1 (9F2000)

Configuration:
standard

A project with XLIFF to reproduce the problem can be found here or see attached.
https://github.com/foo4u/apple-code-xliff-bug/tree/quote-corruption Make sure to check out the quote-corruption branch.

Comments

This is a regression from Xcode 8.3.3.


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!