This question about Configuration, Issue in browser: Answered

UTF-8 problem when saving a topic from CLI

When I try to save a topic from CLI with the following command for example:

./save -text "à l'école des loisirs" -topic TestTopic

The resulting topic is misrendered like this

à l'école des loisirs

I tried different configuration, with locale, without, from freshinstall. The result is the same. I was unable to have the french accent correctly rendered. The server's locale is fr_FR.UTF-8. The file is correctly saved on the filesystem in UTF-8

file ../data/Sandbox/TestTopic.txt
../data/Sandbox/TestTopic.txt: UTF-8 Unicode text

The server's locale configuration

LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=fr_FR.UTF-8

All works fine with from within the browser, no accent problem. This only occurs from cli.

Thanks in advance

-- JeanPhilippeRutault - 04 Jan 2017

The perl interpreter needs to be told that the command line arguments are utf-8 encoded. Unfortunately we missed this from our documentation - though it is mentioned in the "Tips" section in System.CommandAndCGIScripts#A_61upload_61.

Try running =perl -CA ./save -text "à l'école des loisirs" -topic TestTopic = which will tell perl that all command line arguments are expected to be utf-8 encoded. This would apply if the topic name was utf-8 as well.

See http://perldoc.perl.org/perlrun.html for more details on the CLI options for the perl interpreter.

-- GeorgeClark - 04 Jan 2017

It works. Thanks for the quick answer.

-- JeanPhilippeRutault - 04 Jan 2017

I've updated the documentation for the next release to clarify this. See distro:6e1c5cdc9687 (The doc in the commit uses HTML entities so that it can be used on systems with a non-utf8 store. We cannot ship utf-8 characters in our published docs).

-- GeorgeClark - 04 Jan 2017
 

QuestionForm edit

Subject Configuration, Issue in browser
Extension
Version Foswiki 2.1.2
Status Answered
Related Topics
Topic revision: r4 - 04 Jan 2017, GeorgeClark - This page was cached on 04 Jul 2017 - 22:24.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License