Invalid unicode sequence when exporting strings

Hey everybody, we use xcodebuild -exportLocalizations in our project and it doesn't like this line:

return NSLocalizedString("Hello\u{00a0}world", comment: "")

The output we get is:

invalid unicode sequence: \u{00a

I tried other Unicode characters and they all produce this "invalid" message so it's not that.

I looked for other ways to escape it and this seems to be it according to the Swift escaping rules.

Putting in the actual character does work to silence the message. However in this case it's a non-breaking space and there is value in seeing its escaped code so I'd prefer to keep it this way.

I did not find anybody else on the web having this particular message. Any ideas?

Please file a bug through Feedback Assistant. Thanks!

As you've found, a workaround is to use the actual character in the string. You can use the comment to alert localizers to the use of non-breaking space.

Done, thanks!

This is still an issue in Xcode 14.1 (14B47b), at least for \u{2011} (Non-Breaking Hyphen) which gives:

invalid unicode sequence: \u{201
Invalid unicode sequence when exporting strings
 
 
Q