Encoding ids