Hi, All.
I am trying to understand the origin of some unexpected behavior in our web app whereby content encoded as encoding A, but read in as if it were encoding B displays correctly as though the content were actually encoding B (while I am expecting it to fail to render correctly).
My specific situation: we allow users to read a file into our app, and this is implemented using the FileReader object's function ReadAsText. Additionally, we allow the user to declare a specific encoding for the incoming file. The specific bug happens when a user is importing a file that is actually encoded as UTF-8, but they are telling the system that it is iso-8859-2 (Central European ISO). When I call "ReadAsText," I pass the string "iso-8859-2" as the second parameter. I would expect the content to fail to render correctly, but, instead, the result property of the FileReader reveals that the content looks just fine (as though the FileReader read the file in knowing it was UTF-8). I see the same behavior in Chrome and Chromium.
I know that the FileReader defaults to UTF-8 encoding when no encoding is passed, and I believe the FileReader defaults to UTF-8 encoding when it doesn't know the encoding value that is passed as a parameter. Can anyone tell me if Chrome or Chromium does not currently support iso-8859-2, or where I might be able to find that information? Alternatively, is there a way to identify which encoding the FileReader object is using to read the content once ReadAsText is called?
Thanks!