A method of detecting the encoding utilized in an electronic document
includes testing the text strings to determine whether the electronic
document contains only text strings having legal numeric codes. A
statistical analysis of the text strings is then conducted to provide a
mapping of legally coded candidates. The legally coded candidates are
ranked and combined with an expected ranking of legally coded candidates
to provide a most probable character mapping.