The language they are using implies they mean Unicode points when they say "character". The "characters" in Java are utf16 representations of those characters, and it is those that your code is testing.

So there is a mismatch. Either need to (a) translate the XML rule from codepoibts to utf16 to apply to Java characters or (b) convert the JAva characters to codepoint to apply the codepoint rule. I'd rather use (a).

Sent from my Windows Phone
________________________________
From: Chris Tavares<mailto:notifications@github.com>
Sent: ý2/ý21/ý2013 8:24 PM
To: christav/azure-sdk-for-java<mailto:azure-sdk-for-java@noreply.github.com>
Cc: Jason Cooke<mailto:Jason.Cooke@microsoft.com>
Subject: Re: [azure-sdk-for-java] Reduced characters that get encoded to just the illegal set (#11)


In microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java:

> @@ -349,4 +338,9 @@ private String encodeNumericCharacterReference(String value) {
>              return stringBuffer.toString();
>          }
>      }
> +
> +    private boolean isIllegalChar(char c) {
> +        return !(c == 9 || c == 0xA || c == 0xD || (c >= 0x20 && c < 0xD800) ||
> +                (c >= 0xE000 && c < 0xFFFE) || (c >= 0x10000 && c < 0x110000));


Based on the XML spec at http://www.w3.org/TR/xml/#charsets, the valid characters are:

Char       ::=      #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]


This explicitly excludes the surrogate character ranges.

—
Reply to this email directly or view it on GitHub<https://github.com/christav/azure-sdk-for-java/pull/11/files#r3111546>.