sync: read UTF8 string, don't expect sane encoding from imported files, just force it
This commit is contained in:
parent
e126743d69
commit
492ab72dcd
2 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
Détails de l'aborescence attendue
|
Détails de l'aborescence attendue
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
|
Tous les textes doivent utiliser l'encodage UTF8.
|
||||||
|
|
||||||
- Un dossier par thème `IDTEAM-Nom du thème` (`IDTEAM` peut être un mot, sans tiret `-` ; le nom du thème est celui qui sera affiché dans l'interface, soyez créatifs !), contenant :
|
- Un dossier par thème `IDTEAM-Nom du thème` (`IDTEAM` peut être un mot, sans tiret `-` ; le nom du thème est celui qui sera affiché dans l'interface, soyez créatifs !), contenant :
|
||||||
* `AUTHORS.txt` avec vos noms, tels qu'ils apparraîtront sur le site (voir exemple [plus bas](#exemple-authorstxt))
|
* `AUTHORS.txt` avec vos noms, tels qu'ils apparraîtront sur le site (voir exemple [plus bas](#exemple-authorstxt))
|
||||||
* `overview.txt` une présentation rapide du scenario (~2-3 phrases d'accroche pour lecture rapide), compréhensible par un décideur, petit schéma à l'appui
|
* `overview.txt` une présentation rapide du scenario (~2-3 phrases d'accroche pour lecture rapide), compréhensible par un décideur, petit schéma à l'appui
|
||||||
|
|
|
@ -81,7 +81,13 @@ func getFileContent(i Importer, URI string) (string, error) {
|
||||||
if err := getFile(i, URI, bufio.NewWriter(io.Writer(&cnt))); err != nil {
|
if err := getFile(i, URI, bufio.NewWriter(io.Writer(&cnt))); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
} else {
|
} else {
|
||||||
return strings.TrimSpace(cnt.String()), nil
|
// Ensure we read UTF-8 content.
|
||||||
|
buf := make([]rune, 0)
|
||||||
|
for b, _, err := cnt.ReadRune(); err == nil; b, _, err = cnt.ReadRune() {
|
||||||
|
buf = append(buf, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimSpace(string(buf)), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue