[Test] charset
by Francisco
HTML
<script src="https://mapea4-sigc.juntadeandalucia.es/js/mapea-5.0.0.ol.min.js"></script>
<script src="http://mapea4-sigc.juntadeandalucia.es/js/configuration-5.0.0.js"></script>
<link rel="stylesheet" href="https://mapea4-sigc.juntadeandalucia.es/assets/css/mapea-5.0.0.ol.min.css">
<head>
<meta charset="UTF-8">
</head>
<body>
<span id="myspan">RESPUESTA</span>
</body>
CSS
html,
body,
#map {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
/* Colores personalizados para algunos controles */
.ol-zoom>button {
background-color: #8d8784 !important;
color: #FFFFFF !important;
}
JavaScript
M.remote.get("http://www.ieca.junta-andalucia.es/iea/publicaciones/tmpMapas/datos-mapa-54345_1557724631517.xml",{
encoding: 'utf-8'
}).then(function(response) {
if (!("TextDecoder" in window))
alert("Sorry, this browser does not support TextDecoder...");
let decoder = new TextDecoder("utf-8");
//let ui = new TextEncoder().encode(response.text);
let coded = Uint8Array.from(response.text, function(c) {
return c.codePointAt(0);
});
console.log(coded);
let text = decoder.decode(coded);
document.getElementById("myspan").textContent = response.text;
//document.getElementById("myspan").textContent=response.text;
});