From: Joe W. <jo...@gm...> - 2011-04-30 16:07:14
|
Hi Ken, >> Question 1: Can collection names in eXist contain Unicode characters beyond >> the ASCII range? Yes. A similar question came up in this thread about ampersands in collection names (http://markmail.org/message/5rtwgh6bxlqbkvty): > Check out the xmldb:encode-uri() and xmldb:decode-uri() functions -- > see http://demo.exist-db.org/exist/functions/xmldb/encode-uri and > http://demo.exist-db.org/exist/functions/xmldb/decode-uri. To speak to your case, xmldb:create-collection('/db', xmldb:encode-uri("Ö")) returns: /db/%C3%96 This may look odd, but it is the URI-encoded version of Ö, and it appears correctly when browsing your collection hierarchy in oXygen's Database Explorer view, or in the eXist admin Browse Collections panel. These applications know how to encode and decode URIs properly. Indeed, since your application may be handed a character you don't expect, it's good practice to encode and decode your database URIs. I'd encourage you to browse the source of the eXist admin Browse Collections to see encoding and decoding in action according to this best practice: http://exist.svn.sourceforge.net/viewvc/exist/trunk/eXist/webapp/admin/browse.xqm?revision=14352&view=markup You'll see the app encoding a URI when it is making a request to the database -- and decoding a URI when it is displaying a collection (or resource) name to the user. Special characters might seem like more trouble than they're worth, but if you consistently encode and decode the URI you can handle anything your app is presented with. Cheers, Joe |