Added #encode_identifer method to replace unsafe URI characters in resource IDs with _