The way special characters are escaped is not consistent with IRIs, so it's hard to treat them equivalently: the URL-as-ID production rule uses backslash escaped characters, but escaping should use the URL/URI/IRI percent-encoding instead to be compatible with IRI syntax.