encode name into code and vice versa