Skip to content

Instantly share code, notes, and snippets.

@ubermichael
Created December 9, 2016 19:38
Show Gist options
  • Save ubermichael/167a0ff8ed8cbe283c5fa563efd3931f to your computer and use it in GitHub Desktop.
Save ubermichael/167a0ff8ed8cbe283c5fa563efd3931f to your computer and use it in GitHub Desktop.
Normalize unicode by calling java native functions in eXist 2.2 where normalize-unicode() doesn't work.
xquery version "3.0";
(:
Sadly, the eXist 2.2 normalize-unicode() function is broken. So we call out
to the java one.
:)
declare namespace normalizer = "java:java.text.Normalizer";
declare namespace form = "java:java.text.Normalizer$Form";
declare function local:normalize($string as item()) as xs:string {
normalizer:normalize($string, form:value-of('NFD'))
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment