anchor.diff:      :initarg :server
       :reader database-server)
      (name
  -    :initarg :name
       :reader database-name))
     (:documentation
      "Base database class. These objects represent the information required in order to communicate
      with a particular CouchDB database."))
  +
  +(defun url-encode (string)
  +  ;; TODO - escape other characters.
  +  (with-output-to-string (s)
  +    (loop for char across string
  +       do (case char
  +            (#\/ (princ "%2F" s))
  +            (otherwise (write-char char s))))))
  +
  +(defmethod initialize-instance :after ((db standard-database) &key name)
  +  (setf (slot-value db 'name) (url-encode name)))
   
   (defmethod print-object ((db standard-database) stream)
     (print-database db stream))
  
positive.code: ;;; Basic database API
  ;;;
  
  ;; TODO - CouchDB places restrictions on what sort of URLs are accepted, such as everything having
  ;;        to be downcase, and only certain characters being accepted. There is also special meaning
  ;;        behing the use of /, so a mechanism to escape it in certain situations would be good.
  
  (defun url-encode (uri)
    (cl-ppcre:regex-replace-all "/" uri "%2F"))
  
  ;; Database protocol
  (defgeneric make-db-object (server name)
    (:documentation
  
negative.code: (defgeneric database-server (database)
    (:documentation "Returns the server object with which DATABASE is associated."))
  (defgeneric database-name (database)
    (:documentation
     "Returns the URL-encoded name of the database, a string. Note that CouchDB accepts certain
     characters in database names -only- if they are URL-encoded (such as #\/). It is up to individual
     implementations of DATABASE-NAME to implement this encoding."))
  
  ;; Database functions
  (defun print-database (db stream)
  