You could use util_text_to_url which does automatic conflict resolution if you tell it to. According to this bug
https://openacs.org/bugtracker/openacs/com/dotlrn/bug?bug%5fnumber=189 it should have been incorporated in dotlrn already, but since you are asking it apparently isn't. Or maybe it only went into 4.7.