Community
Participate
Working Groups
+++ This bug was initially created as a clone of Bug #280553 +++ Psychopath currently does not implement fn:string-to-codepoints function. http://www.w3.org/TR/xpath-functions/#func-string-to-codepoints
Needs to implement -1 for arity.
Mukul this is similar to the 280555
I have made improvements to this function implementation, and have checked in the code to HEAD. I am not closing this bug, as still few tests fail for this function. But largely, this function seems to be ok now. Out of 22 tests for this function, 3 are failing at the moment.
I've corrected the two tests that were failing. These weren't putting the Expected Error code in the expectedResult string. This value has been hardcoded, according to the XQueryInterop Catalog.xml file rules. Test suite now passes...Mukul, you'll want to verify and then determine if this one can be closed. I've checked the test changes into head.
I've checked it and it has one bug still, related to how codePointAt() works. fn:string-to-codepoints(fn:codepoints-to-string(112233)) would currently return a seqence (112233 56937) (i.e. the high surrogate at index 0 is caught and paired with the low one, but the the low surrogate at index 1 is also converted to and int). The fix is to replace: for (int i = 0; i < str.length(); i++) { // Character.codePointAt API, is introduced in Java 1.5 int codePointValue = Character.codePointAt(str, i); rs.add(new XSInteger(BigInteger.valueOf(codePointValue))); } with for (int i = 0; i < str.length(); i++) { // Character.codePointAt API, is introduced in Java 1.5 int codePointValue = Character.codePointAt(str, i); // codepoint at will also return the low surrogate - omit this if (! Character.isLowSurrogate((char)codePointValue)) { rs.add(new XSInteger(BigInteger.valueOf(codePointValue))); } } This isn't caught in the W3C test suite.
Retargeting to 3.2M2 for completion.
The fix for this is included in the patch for bug 282096, since it relies on a shared utility class.
This is now fixed with the latest commits to head. Thanks jesper and mukul.