XML String
data = "<?xml version='1.0' encoding='ISO-8859-1'?><OTA_HotelAvailRS xmlns=\"http://parsec.es/hotelapi/OTA2014Compact\" TimeStamp=\"2021-03-17T08:56:29Z\" PrimaryLangID=\"en-GB\" Id=\"11,33667649,72545\"><Hotels HotelCount=\"0\"><DateRange Start=\"2021-04-20\" End=\"2021-04-21\" /><RoomCandidates><RoomCandidate RPH=\"0\"><Guests><Guest AgeCode=\"A\" Count=\"2\" /></Guests></RoomCandidate></RoomCandidates></Hotels></OTA_HotelAvailRS>"
Here, the encoding value is ISO-8859-1.
Now, if I try run simple form it is giving me the following error
Error
iex(12)> Saxy.SimpleForm.parse_string(data)
{:error,
%Saxy.ParseError{
binary: "<?xml version='1.0' encoding='ISO-8859-1'?><OTA_HotelAvailRS xmlns=\"http://parsec.es/hotelapi/OTA2014Compact\" TimeStamp=\"2021-03-17T08:56:29Z\" PrimaryLangID=\"en-GB\" Id=\"11,33667649,72545\"><Hotels HotelCount=\"0\"><DateRange Start=\"2021-04-20\" End=\"2021-04-21\" /><RoomCandidates><RoomCandidate RPH=\"0\"><Guests><Guest AgeCode=\"A\" Count=\"2\" /></Guests></RoomCandidate></RoomCandidates></Hotels></OTA_HotelAvailRS>",
position: 30,
reason: {:invalid_encoding, "ISO-8859-1"}
}}
I tried to replace ISO-8859-1 with 'UTF-8' and it is working fine.
Is there a way to parse ISO-8859-1 encoded xml?
XML String
Here, the encoding value is
ISO-8859-1.Now, if I try run simple form it is giving me the following error
Error
I tried to replace
ISO-8859-1with 'UTF-8' and it is working fine.Is there a way to parse
ISO-8859-1encoded xml?