NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.58k stars 309 forks source link

Foriegn characters are translated to what seems to be a Unicide Hex #663

Closed RUlens closed 2 months ago

RUlens commented 4 months ago

Description

I use the parser to convert public XML's to JSON but it seems that foreign character like for example ó are converted when imported to ó

Input

I included an example URL I fetch from https://www.immodelux.com/feed/kyero/ver/kantoren-samenwerking

Code

export async function getXMLAndParseToJSON() { return fetch("https://www.immodelux.com/feed/kyero/ver/kantoren-samenwerking/", { 'method': 'get', headers: { 'Content-Type': 'application/XML' } }) .then((httpResponse) => { return httpResponse.text() .then((response) => { xml = String(response) xml = parser.parse(xml) return xml.root.property }) })

}

Output

Part of JSON

{ "id": 423667, "date": "2023-12-07 11:29:40", "ref": "A000008", "price": 399900, "currency": "EUR", "price_freq": "sale", "new_build": 1, "type": "Bungalow", "town": "Finestrat", "province": "Alicante", "location_detail": "Balcón de finestrat", "beds": 3, "baths": 2, "pool": 1, "surface_area": { "built": 256 }, "url": { "es": "http://www.immodelux.com/es/propiedad/finestrat-moderno-chalet-adosado-de-nueva-construccion-con-piscina-privada-a000008/", "en": "http://www.immodelux.com/en/property/finestrat-modern-semi-detached-newly-built-villa-with-private-pool-a000008/", "de": "http://www.immodelux.com/de/eigentum/finestrat-moderne-neu-gebaute-doppelhaushalfte-mit-privatem-pool-a000008/", "fr": "http://www.immodelux.com/fr/propriete/finestrat-villa-moderne-jumelee-de-construction-recente-avec-piscine-privee-a000008/", "nl": "http://www.immodelux.com/eigenschap/finestrat-moderne-nieuwbouw-bungalow-a000008/" }, "video_url": "", "desc": { "es": "Este exclusivo complejo de nueva construcción tiene vistas a Benidorm.. En este complejo encontrará exclusivas casas adosadas y bungalows.. . Todas las propiedades tienen piscina privada. Las casas de la planta superior tienen un solárium.. . Esta propiedad se encuentra en la planta baja y tiene 3 dormitorios y 3 baños, gran salón y comedor, cocina abierta con grandes ventanales, gran jardín con piscina privada y plaza de aparcamiento.", "en": "This exclusive new-build complex overlooks Benidorm.. In this complex you will find exclusive semi-detached houses and bungalows.. . All properties have a private pool. The houses on the top floor have a solarium.. . This property is on the ground floor and has 3 bedrooms and 3 bathrooms, large living and dining room, open kitchen with large windows, large garden with private pool and parking space.", "de": "Dieser exklusive Neubaukomplex liegt mit Blick auf Benidorm.. In dieser Anlage finden Sie exklusive Doppelhaushälften und Bungalows.. . Alle Immobilien haben einen privaten Pool. Die Häuser im obersten Stockwerk haben eine Sonnenterrasse.. . Dieses Anwesen befindet sich im Erdgeschoss und verfügt über 3 Schlafzimmer und 3 Bäder, großes Wohn- und Esszimmer, offene Küche mit großen Fenstern, großer Garten mit privatem Pool und Parkplatz.", "fr": "Ce complexe exclusif, de construction récente, surplombe Benidorm.. Dans ce complexe, vous trouverez des maisons jumelées et des bungalows exclusifs.. . Toutes les propriétés disposent d'une piscine privée. Les maisons du dernier étage disposent d'un solarium.. . Cette propriété est au rez-de-chaussée et comprend 3 chambres et 3 salles de bains, un grand salon et une salle à manger, une cuisine ouverte avec de grandes fenêtres, un grand jardin avec une piscine privée et un espace de stationnement.", "nl": "Dit exclusief nieuwbouw complex heeft uitzicht op Benidorm. In dit complex vind u exclusieve geschakelde woningen en bungalows. \n \nAlle woningen hebben een privé zwembad. \nDe woningen op de bovenste verdieping hebben een solarium. \nDeze woning heeft 3 slaapkamers en 2 badkamers, grote woon- en eetkamer, open keuken met grote ramen, solarium en parkeerplaats. \n \nVoorziene opleverdatum is april 2025" }, "features": { "feature": [ "air conditioning yes", "heating yes", "terrace", "garden", "orientation: Sur" ] }, "images": { "image": [ { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44444d8b66-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444b89b36-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444bf2546-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444b2c738-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b444455f762-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444657e19-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44446be957-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b444472e167-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444789507-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44448005ab-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444868b40-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44448cb3b5-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b444493da30-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44449b8478-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444a3e18d-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444aa61bd-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444c66c2d-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444ccdcaa-source.jpg" } ] } }

expected data

{ "id": 423667, "date": "2023-12-07 11:29:40", "ref": "A000008", "price": 399900, "currency": "EUR", "price_freq": "sale", "new_build": 1, "type": "Bungalow", "town": "Finestrat", "province": "Alicante", "location_detail": "Balcón de finestrat", "beds": 3, "baths": 2, "pool": 1, "surface_area": { "built": 256 }, "url": { "es": "http://www.immodelux.com/es/propiedad/finestrat-moderno-chalet-adosado-de-nueva-construccion-con-piscina-privada-a000008/", "en": "http://www.immodelux.com/en/property/finestrat-modern-semi-detached-newly-built-villa-with-private-pool-a000008/", "de": "http://www.immodelux.com/de/eigentum/finestrat-moderne-neu-gebaute-doppelhaushalfte-mit-privatem-pool-a000008/", "fr": "http://www.immodelux.com/fr/propriete/finestrat-villa-moderne-jumelee-de-construction-recente-avec-piscine-privee-a000008/", "nl": "http://www.immodelux.com/eigenschap/finestrat-moderne-nieuwbouw-bungalow-a000008/" }, "video_url": "", "desc": { "es": "Este exclusivo complejo de nueva construcción tiene vistas a Benidorm.. En este complejo encontrará exclusivas casas adosadas y bungalows.. . Todas las propiedades tienen piscina privada. Las casas de la planta superior tienen un solárium.. . Esta propiedad se encuentra en la planta baja y tiene 3 dormitorios y 3 baños, gran salón y comedor, cocina abierta con grandes ventanales, gran jardín con piscina privada y plaza de aparcamiento.", "en": "This exclusive new-build complex overlooks Benidorm.. In this complex you will find exclusive semi-detached houses and bungalows.. . All properties have a private pool. The houses on the top floor have a solarium.. . This property is on the ground floor and has 3 bedrooms and 3 bathrooms, large living and dining room, open kitchen with large windows, large garden with private pool and parking space.", "de": "Dieser exklusive Neubaukomplex liegt mit Blick auf Benidorm.. In dieser Anlage finden Sie exklusive Doppelhaushälften und Bungalows.. . Alle Immobilien haben einen privaten Pool. Die Häuser im obersten Stockwerk haben eine Sonnenterrasse.. . Dieses Anwesen befindet sich im Erdgeschoss und verfügt über 3 Schlafzimmer und 3 Bäder, großes Wohn- und Esszimmer, offene Küche mit großen Fenstern, großer Garten mit privatem Pool und Parkplatz.", "fr": "Ce complexe exclusif, de construction récente, surplombe Benidorm.. Dans ce complexe, vous trouverez des maisons jumelées et des bungalows exclusifs.. . Toutes les propriétés disposent d'une piscine privée. Les maisons du dernier étage disposent d'un solarium.. . Cette propriété est au rez-de-chaussée et comprend 3 chambres et 3 salles de bains, un grand salon et une salle à manger, une cuisine ouverte avec de grandes fenêtres, un grand jardin avec une piscine privée et un espace de stationnement.", "nl": "Dit exclusief nieuwbouw complex heeft uitzicht op Benidorm. In dit complex vind u exclusieve geschakelde woningen en bungalows. \n \nAlle woningen hebben een privé zwembad. \nDe woningen op de bovenste verdieping hebben een solarium. \nDeze woning heeft 3 slaapkamers en 2 badkamers, grote woon- en eetkamer, open keuken met grote ramen, solarium en parkeerplaats. \n \nVoorziene opleverdatum is april 2025" }, "features": { "feature": [ "air conditioning yes", "heating yes", "terrace", "garden", "orientation: Sur" ] }, "images": { "image": [ { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44444d8b66-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444b89b36-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444bf2546-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444b2c738-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b444455f762-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444657e19-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44446be957-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b444472e167-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444789507-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44448005ab-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444868b40-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44448cb3b5-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b444493da30-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b44449b8478-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444a3e18d-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444aa61bd-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444c66c2d-source.jpg" }, { "url": "https://www.immodelux.com/objetos/temp/source/immodelux/immodelux-propiedades_63b4444ccdcaa-source.jpg" } ] } }

Would you like to work on this issue?

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

github-actions[bot] commented 4 months ago

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

amitguptagwl commented 4 months ago

It was quite difficult to follow. Can you please short the input XML and highlight the issue?

amitguptagwl commented 2 months ago

closing as no response. feel free to reopen it for further discussion