added rawurlencode for encoding a segment