Xcode corrupts unicode (emoji) characters in pbxproj file during conversion from XML

Originator:e.poot
Number:rdar://26948026 Date Originated:2016/06/22
Status:Open Resolved:No
Product:Developer Tools (Xcode) Product Version:7.3.1 (7D1014)
Classification:Serious bug Reproducible:Always
 
I have a project that has several build scripts (build phases) that include a emoji unicode char in the name.

I use a library to programmatically edit the pbxproj file. This library succesfully writes any new contents to the pbxproj in XML format. The emoji are displayed correctly as expected.

However, at some point Xcode will read the XML and convert it to another format (looks like JSON). The unicode characters then become corrupted.

Steps to Reproduce:
1. Create Xcode project
2. Add run script phase through 'build phases' tab of a target
3. Give it a title that contains an emoji (e.g. 📦 Check Pods Manifest.lock)
4. convert the pbpxproj file to XML (e.g. plutil -convert xml1 -o project.pbxproj project.pbxproj)
5. In the XML confirm that the emoji are still presented correctly.  (refer to the screenshot attached with name '1')
5. If the Xcode project is opened in Xcode then the conversion to the other format happens automatically.
If the project is not opened in Xcode, first trigger a change to the project (e.g. an extra space in a build script) to let it convert the file back to the other format
6. Inspect the build phases for the project, the run script emoji in the name is now corrupted. (refer to the screenshot attached with name '2')

Expected Results:
Xcode respecting the unicode emoji during conversion

Actual Results:
Unicode emoji encoding is corrupted

Version:
Xcode version 7.3.1 (7D1014)
OS X version 10.11.4

Comments

Aple Response

There are no plans to address this based on the following:

We do not officially support the XML file format or workflows involving it.


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!