A poorly made text editor might save the replacement character in UTF-8, and the text file data will then look like this: codice_3, which will be displayed in ISO-8859-1 as "fï¿1⁄2r" (this is called mojibake). Since the replacement is the same for all errors this makes it impossible to get the first character. A better (but harder to make) way is to keep the original bytes, including the error, and only convert to the replacement when "displaying" the text. This will allow the text editor to save the original byte sequence, while still showing the error to the user.