Modifying the encoding on client side.
Adding a catch of errors when generating the training data.

The generation of training data is done not only on 1 pdf but severals.
If the process of 1 pdf fails all the generation stops. A try/catch
block has been added to log an error in the log file when the
processing of a pdf fails and then start the processing of the next one.