Based on dan04's comment above, we can guess that somehow the letter "è" was misinterpreted as an "Š", which then had three-fold UTF-8 encoding applied to it.
So how did "è" turn into "Š", then? Well, I had a hunch that the most likely explanation would be between two different 8-bit charsets, so I looked up some common character encodings on Wikipedia, and found a match: in CP850 (and in various other related 8-bit DOS code pages, such as CP851, CP853, CP857, etc.) the letter "è" is encoded as the byte 0x8A, which in Windows-1252 represents "Š" instead.
With this knowledge, we can recreate this tortuous chain of mis-encodings with a simple Unix shell command line:
$ echo "Trois-Rivières" \
| iconv -t cp850 \
| iconv -f windows-1252 -t utf-8 \
| iconv -f iso-8859-1 -t utf-8 \
| iconv -f iso-8859-1 -t utf-8 \
| iconv -f ascii --byte-subst='\x%02X'
Trois-Rivi\xC3\x83\xC2\x85\xC3\x82\xC2\xA0res
Here, the first iconv
call just converts the string from my local character encoding — which happens to be UTF-8 — to CP850, and the last one just encodes the non-ASCII bytes with Python-style \xNN
escape codes. The three iconv
calls in the middle recreate the actual re-encoding steps applied to the data: first from (assumed) Windows-1252 to UTF-8, and then twice from ISO-8859-1 to UTF-8.
So how can we fix it? Well, we just need to apply the same steps in reverse:
$ echo -e 'Trois-Rivi\xC3\x83\xC2\x85\xC3\x82\xC2\xA0res' \
| iconv -f utf-8 -t iso-8859-1 \
| iconv -f utf-8 -t iso-8859-1 \
| iconv -f utf-8 -t windows-1252 \
| iconv -f cp850
Trois-Rivières
The good news is that this process should be mostly reversible. The bad news is that any "ü", "ì", "Å", "É" and "Ø" letters in the original text may have been irreversibly mangled, since the bytes used to encode those letters in CP850 are undefined in Windows-1252. (If you're lucky, they may have been interpreted as the same C1 control codes that those bytes represent in ISO-8859-1, in which case back-conversion should in principle be possible. I haven't managed to figure out how to convince iconv
to do it, though.)