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

encode special characters when serializing entity to XML #9

Merged
merged 2 commits into from
Aug 2, 2012
Merged

Conversation

gcheng
Copy link
Owner

@gcheng gcheng commented Jul 30, 2012


assertNotNull(result.getEntity().getProperty("test"));
String actualTest1 = (String) result.getEntity().getProperty("test").getValue();
assertEquals("", actualTest1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the relation between \u0005 and &#5?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. actualTest1 should be equal to "\u0005". The XML should be un-encoded when read back from the server. If it is not, then you have a bug and the test should be failing.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\u0005 is java's way of encoding special character, which cannot be accept in web service. In Web Service world, it is widely adopted to use Numeric Character Reference (http://en.wikipedia.org/wiki/Numeric_character_reference ). Unfortunately, decode numeric character reference is not provided in standard Java library. We can consider doing that for the customer in the convenience layer.
A new issue filed Azure#142

@jcookems
Copy link

I don't see where you have addressed the second part of the issue, the loss of whitespace. Please add a unit test for that as well, to verify that your fix completely fixes the issue.

gcheng pushed a commit that referenced this pull request Aug 2, 2012
encode special characters when serializing entity to XML
@gcheng gcheng merged commit 17cf30a into dev Aug 2, 2012
gcheng pushed a commit that referenced this pull request Jan 25, 2013
Forward Integration from dev to AssetCRUD branch.
gcheng pushed a commit that referenced this pull request Jan 25, 2013
Removed use of XMLGregorianCalendar
gcheng pushed a commit that referenced this pull request Jan 25, 2013
Refactor Replace hard-coded "urn:WindowsAzureMediaServices" in tests wit...
gcheng pushed a commit that referenced this pull request Feb 27, 2013
Fixed test cross contamination - create new config, don't reuse current ...
gcheng pushed a commit that referenced this pull request Mar 9, 2013
Merge changes from the private branch to release branch
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

Successfully merging this pull request may close these issues.

3 participants