1. A method for encoding characters appearing in an area of an image in order to generate a corresponding output string of character codes, the method comprising: identifying one or more sequences of the character codes that are likely to be generated due a segmentation error in application of a pattern recognition process, and associating a respective extension character code with each of the sequences; dividing the area of the image into segments such that each segment contains approximately one character; applying the pattern recognition process to each of the segments in order to generate an input string of character codes, the input string comprising a respective character code for each of the segments; locating at least one of the sequences of the character codes in the input string, and replacing the at least one of the sequences with the respective extension character code so as to generate a modified string; and determining the output string by comparing the modified string to a directory of known strings.