This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RN's fetch seems to not handling responses with other charsets correctly like Node.js does | |
// eg. the following link returns content-type: "text/html; charset=ISO-8859-1" | |
// https://www.corriere.it/cronache/20_marzo_13/coronavirus-ultimi-aggiornamenti-dall-italia-mondo-d4c07168-64f4-11ea-ac89-181bb7c2e00e.shtml | |
// response.text() resolves to undefined | |
const src = await fetch(url) | |
.then(response => { | |
const charset = (response.headers.get("content-type") || "").split( | |
"charset=" | |
)[1]; | |
if (!charset || charset.toLowerCase() === "utf-8") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Title: SFEN parser | |
* Date: 23-Jan-2014 | |
* Author: Daichi Shinozaki <[email protected]> | |
* Demo URL: http://jsfiddle.net/dseg/QezQ7/15/ | |
* | |
* Note: | |
* Tested with PEG.js 0.8.0 | |
* http://pegjs.majda.cz/ | |
* |