de.setf.wilbur
de.setf.wilbur copied to clipboard
Collapse whitespace
I had a problem when parsing an UTF-8 encoded RDF/XML document.
(wilbur:collapse-whitespace "Grüß Gott")
Signals an error:
Cannot decode this: (#\LATIN_SMALL_LETTER_U_WITH_DIAERESIS
#\LATIN_SMALL_LETTER_SHARP_S #\ #\G #\o
#\t #\t)
[Condition of type SIMPLE-ERROR]
Here is a fix.
the principle issue is that wilbur - in its inherited form, predates any reasonable support for utf encoding. the whitespace predicate appears to reflect this.
i am not a user (see dydra.com) and set it up here so that it would not disappear. if you intend to use it, would you consider integrating the capabilities which are now present in lisp implementations?
also, your whitespace characterization seems suspect.
Long time ago I faced similar problem. Better solution would be to remove from Wilbur all xml functions and delegate it to an external lib such as https://common-lisp.net/project/cxml/
as i noted earlier, my interest in wilbur is curatorial.
the current dependencies are minimal.
preferences are for corrections rather than introducing significant dependencies.
it would be a significant compromise of its artifactual status to introduce a large dependency to replace an aspect which, in its state of incompleteness, expresses a judgement about the role of rdf-xml. especially when the rdf ecosystem has moved on to numerous encoding alternatives. while open-source lisp rdf environments have not, it is not clear that replacing that component of wilbur would change that situation.
i am open to being convinced otherwise.
the principle issue is that wilbur - in its inherited form, predates any reasonable support for utf encoding. the whitespace predicate appears to reflect this.
The character encoding should be handled by the reader, e.g. the web client - I'm using Drakma, which works well for me. Wilbur only has to deal with Lisp characters.
i am not a user (see dydra.com) and set it up here so that it would not disappear. if you intend to use it, would you consider integrating the capabilities which are now present in lisp implementations?
How do you imagine that? Shall I take over maintenance?
also, your whitespace characterization seems suspect.
I don't think so. It's according to the ASCII definition.
if the goal is to make this artefact behave better with unicode, then wrt whitespace the class of non-graphic characters does not coincide with that of whitespace characters. https://en.wikipedia.org/wiki/Whitespace_character
The character encoding should be handled by the reader, e.g. the web client - I'm using Drakma, which works well for me. Wilbur only has to deal with Lisp characters.
in some sense that is true, but the change removes the primitive support which it had for utf decoding in that one function, which leaves one to wonder where else that situation applies.
How do you imagine that? Shall I take over maintenance?
you are certainly free to fork it.