protected function encodeAndValidatePathForDavex($path)
{
PathHelper::assertValidAbsolutePath($path);
$path = rawurlencode($path);
// we encoded the whole path, need to rebuild slashes and parenthesis
// this will not collide with %2F as % was encoded by rawurlencode
$path = str_replace(array('%2F', '%5B', '%5D'), array('/', '[', ']'), $path);
return $path;
}