Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd behavior with blank strings #4

Open
Nonsanity opened this issue Jul 15, 2014 · 0 comments
Open

Odd behavior with blank strings #4

Nonsanity opened this issue Jul 15, 2014 · 0 comments

Comments

@Nonsanity
Copy link

I am parsing a BSON message to an NSDictionary. The BSON has an array like this:

{
Data = "some data"; // all strings are String (not CString)
Name = "my name";
Things = ( "thing1", "thing2" ); // an array of Strings
},{
Data = "more data";
Name = "another name";
Things = ( "thing3", "thing4" );
}

This works fine converting the BSON to NSDictionary. But when Name is an empty string (not nil—I know that breaks NSDictionary), the "Things" array that comes after it in the BSON structure doesn't get added to the dictionary:

{
Data = "more data";
Name = "";
}

Though the array IS in the BSON. Just changing the Name field to be a space (if it would otherwise be empty) makes the Things array show up again in the output NSDictionary.

Also, if I change the order of the elements so that Things comes before Name, then Things is retained even when Name is an empty string. So order counts here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant