When using the apple provided server 2 server sample code, it fails on special characters in strings

Originator:jeroen.leenarts
Number:rdar://24757030 Date Originated:20-Feb-2016
Status:Open Resolved:
Product:sample code Product Version:
Classification: Reproducible:
 
Summary:
When entering a string with special characters into the sample code it fails with a authentication failure. While that exact same code works fine when entering a string that does not contains special characters.

An example of such a string is: "Théâtre des Variétés"

Steps to Reproduce:
1. Download Apple sample for the node.js server to server example: https://developer.apple.com/library/prerelease/ios/samplecode/CloudAtlas/Introduction/Intro.html#//apple_ref/doc/uid/TP40014599
2. Follow the setup instruction for the server-2-server example.
3. Validate that the setup works.
4. Edit line 48 in index.js from:
      return database.saveRecords({recordType: 'Test', recordName: 'hello-u'});
to:
      return database.saveRecords({recordType: 'Test', recordName: 'hello-u', fields: { StringField: { value:"Théâtre des Variétés") }}});
5. Modify the Test record type, add field names "StringField" of type string.
6. Rerun the sample code, it now fails.
7. Replace the string "Théâtre des Variétés" with "Simple example"
8. Rerun the sample code, it now works.

Expected Results:
I would very much like to be able to send any unicode string to the server and have the server save that value.

The browser based sample allows me to do just that. Also through iCloud dashboard I can enter strings with special characters.

Actual Results:
In the fail case I get an output ending with:

{ [Error: Authentication failed]
  _ckErrorCode: 'AUTHENTICATION_FAILED',
  _uuid: '163243ab-8145-4f3e-9e79-efce248defd3',
  _reason: 'Authentication failed',
  _serverErrorCode: 'AUTHENTICATION_FAILED',
  _extensionErrorCode: undefined,
  _retryAfter: undefined,
  _recordName: undefined,
  _subscriptionID: undefined,
  _zoneID: undefined,
  _redirectURL: undefined,
  message: 'Authentication failed' }

Version:
Apple provided sample code with a slight modification: https://developer.apple.com/library/prerelease/ios/samplecode/CloudAtlas/Introduction/Intro.html#//apple_ref/doc/uid/TP40014599

Notes:


Configuration:


Attachments:

Comments

Problem is even easier to reproduce.

Just add a special character on line 48 of the index.js of the sample code.

ie.

return database.saveRecords({recordType: 'Test', recordName: 'hello-ü'});

By jeroen.leenarts at March 8, 2016, 8:08 p.m. (reply...)

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!