func bindValueURI()

in wfn/uri.go [134:163]


func bindValueURI(s string) string {
	var out []byte
	switch s {
	case NA:
		return "-"
	case Any:
		return ""
	}
	for i := 0; i < len(s); i++ {
		b := byte(s[i])
		if b >= '0' && b <= '9' || b >= 'a' && b <= 'z' || b >= 'A' && b <= 'Z' || b == '_' {
			// alnum + '_' pass untouched
			out = append(out, b)
		} else if b == '\\' {
			// percent-encode escaped characters
			// sanity check should be done during unbinding, so here we silently skip all
			// illegal characters
			i++
			if i == len(s) {
				break
			}
			out = append(out, pctEncode(s[i])...)
		} else if b == '?' { // unquoted '?' -> "%01"
			out = append(out, '%', '0', '1')
		} else if b == '*' { // unquoted '*' -> "%02"
			out = append(out, '%', '0', '2')
		}
	}
	return string(out)
}