diff --git a/README.md b/README.md index 3afa2332beb7ad551bcc1d14ed5fdf4540196a1e..f3ac25265754721f33eaa9452e43e3ff39029ded 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,18 @@ sudo docker container run xle $(cat data.json | base64 -w0) The idea to implement it that way came from [Christian Heusel](https://christian.heusel.eu/), thank you very much! </details> +## :abcd: A word about encoding + +By default, this container lets XLE use its default encoding, whatever that is (not UTF-8). If you want to use UTF-8, you have to add the following line to your grammar file in the `CONFIG` section + +``` +CHARACTERENCODING utf-8. +``` + +**and** execute `set-character-encoding stdio utf-8` every time after starting XLE. + +`xle-docker` will automatically use `utf-8` as character encoding for standard input if it detects the character encoding configuration line (more precisely, a line matching `^\s*CHARACTERENCODING\s+utf-8\s*\..*$` anywhere in the file). + ## :page_with_curl: About Here, a more detailed explanation of the relevant files is given. The used sources are marked with :books:. diff --git a/entrypoint.sh b/entrypoint.sh index ff56c2208a4536cf0330e4a28cae043fb0640867..7ce771b86baba3cbeef245da9dbf21bb0498bfdd 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -15,8 +15,12 @@ else SENTENCE=$1 fi +export LC_ALL="C.utf8" + # Write xlerc containing instructions to parse echo "create-parser /grammar.lfg" > xlerc +# Check if we are using utf-8 +#(grep -E '^\s*CHARACTERENCODING\s+utf-8\s*\..*$' /grammar.lfg > /dev/null) && echo "set-character-encoding stdio utf-8" >> xlerc echo "packed-xml-fs { $SENTENCE } packed-parses.xml" >> xlerc echo "exit" >> xlerc