build: complete Windows installer lang list in meson and fix iconv…

… conversion when some characters are not convertible.

Currently failed conversion ended up in incomplete .isl files (autotools
build) or would break the build (meson build). Ideally we should use a
target encoding which contains all source characters, but we use the
encoding as set upstream in the LanguageCodePage for the given language
file.
I'm not sure if maybe we can mix the encoding by adding our own
LanguageCodePage at the top of our generated <code>.setup.isl, then we
could just use UTF-8 for any language. It will have to be tested.

For now let's just discard non-convertible characters, assuming there
shouldn't be too many of these. It's the lesser evil in this situation.
This commit is contained in:
Jehan 2021-06-18 20:22:04 +02:00
parent 2d6bf6dec5
commit a6c44a7191
3 changed files with 18 additions and 2 deletions

View File

@ -54,7 +54,7 @@ stamp-isl: setup.isl Makefile.am
isl="$(srcdir)/$$code.setup.isl"; \
echo " GEN $$isl"; \
sed '/^\w\+'"$$prefix"'=/{s/\(.\)'"$$prefix"'/\1/;n};/^\w.*=/d' $< | \
iconv -f UTF-8 -t $$encoding > "$$isl"; \
iconv -c -f UTF-8 -t $$encoding > "$$isl"; \
done && \
echo timestamp > stamp-isl

View File

@ -8,4 +8,9 @@ prefix=$(echo "$prefix" | sed 's/[][]/\\\0/g')
#echo to stdout
sed '/^\w\+'"$prefix"'=/{s/\(.\)'"$prefix"'/\1/;n};/^\w.*=/d' "$infile" \
| iconv -f UTF-8 -t "$encoding"
| iconv -c -f UTF-8 -t "$encoding"
# TODO: currently we silently discard non-convertible characters with -c
# option on iconv. Eventually we would want to just use UTF-8 for all
# language files (ideally), instead of folloding the LanguageCodePage of
# the main .isl file as provided in the issrc repository.

View File

@ -20,23 +20,34 @@ languages = [
{ 'code': 'de', },
{ 'code': 'el', 'encoding': 'WINDOWS-1253', },
{ 'code': 'en', 'prefix': '', },
{ 'code': 'en_GB', 'encoding': 'UTF-8', },
{ 'code': 'eo', 'encoding': 'ISO-8859-3', },
{ 'code': 'es', },
{ 'code': 'eu', },
{ 'code': 'fi', },
{ 'code': 'fr', },
{ 'code': 'he', 'encoding': 'WINDOWS-1255', },
{ 'code': 'hu', 'encoding': 'WINDOWS-1250', },
{ 'code': 'id', 'encoding': 'ISO-8859-1', },
{ 'code': 'is', },
{ 'code': 'it', },
{ 'code': 'ja', 'encoding': 'CP932', },
{ 'code': 'kab', 'encoding': 'UTF-8', },
{ 'code': 'ko', 'encoding': 'EUC-KR', },
{ 'code': 'lv', 'encoding': 'ISO-8859-13', },
{ 'code': 'mr', 'encoding': 'UTF-8', },
{ 'code': 'ms', 'encoding': 'UTF-8', },
{ 'code': 'nl', },
{ 'code': 'pl', 'encoding': 'WINDOWS-1250', },
{ 'code': 'pt_BR', },
{ 'code': 'ro', 'encoding': 'WINDOWS-1250', },
{ 'code': 'ru', 'encoding': 'WINDOWS-1251', },
{ 'code': 'sk', 'encoding': 'WINDOWS-1250', },
{ 'code': 'sl', 'encoding': 'WINDOWS-1250', },
{ 'code': 'sv', },
{ 'code': 'tr', 'encoding': 'WINDOWS-1254', },
{ 'code': 'uk', 'encoding': 'WINDOWS-1251', },
{ 'code': 'vi', 'encoding': 'WINDOWS-1258', },
{ 'code': 'zh_CN', 'encoding': 'WINDOWS-936', },
{ 'code': 'zh_TW', 'encoding': 'CP950', },
]