1. A non-transitory computer-readable recording medium storing therein an encoding program that causes a computer to execute a process comprising: registering, in a dynamic dictionary, strings in input text data that are not contained in a static dictionary; adding, to first hashed data obtained by individually N-dimensionally hashing words contained as registered items in the static dictionary, hashed data obtained by individually hashing strings registered in the dynamic dictionary; determining, by using the first hashed data, whether each input string has been registered in the static dictionary and whether the string has been registered in the dynamic dictionary; and in accordance with a result of the determining, performing encoding based on a content registered in the static dictionary or the dynamic dictionary.