1. A non-transitory computer-readable recording medium having stored therein an encoding program that causes a computer to execute a process comprising: first generating static-encoded data from input text data, utilizing a static dictionary that associates a character strings and static codes, respectively the static-encoded data including a plurality of static codes corresponding to a plurality of character strings that are registered in the static dictionary and character strings that are not registered in the static dictionary among the text data; second generating dynamic-encoded data from the static-encoded data by either encoding a character string that occurs more than once in the static-encoded data into a dynamic code or encoding a static code that occurs more than once in the static-encoded data; first creating a dynamic dictionary associating character strings or static codes with corresponding dynamic codes, respectively; and second creating a Huffman tree and data of a leaf in the Huffman tree based on an occurrence frequency of the dynamic codes and the static codes in the input text data.