I can add that if I use "cat file" on the bash I get the right Greek characters, while the same command via proc:execute returns gibberish characters (the optional argument "utf-8" in proc:execute has no effect). Thanks.
Joseph
Il giorno 09/nov/2015, alle ore 19:04, meumapple <meumapple(a)gmail.com> ha scritto:
Hi,
I do not have any LANG variable set. If I redirect into a file the output of the bash command, I get a message with "utf-8" when I analyze this file with the command "file". And indeed the characters are displayed correctly. So the problem arises only when I run everything through proc:execute. If I save the result of the xquery script and analyze them with "file" I get the message "output: ERROR : line 22 : regexec error 17, (illegal byte sequence). And of course the Greek characters are messed up (but not the ASCII ones for English)
Hope this helps...
Joseph
Il giorno 09/nov/2015, alle ore 15:18, Jens Erat <jens.erat(a)uni-konstanz.de> ha scritto:
Please report the encoding of your actual files. What is the output of
`env | grep LANG` (when stored in your bash script)? If you pipe the
output in another file, what will `file -i [output-file]` report (`file`
applies some magic to discover file formats and encoding)?
> Am 09.11.2015 um 14:06 schrieb meumapple:
> Hi All,
>
> I have been able to run the command just putting it in a bash file and then running this file with proc:execute. It works. The problem now is with the encoding of the text returned by proc:execute. In my bash I can display Greek characters, but they are messed up if returned by the proc:execute function. I also added utf-8 as a parameter for the function but nothing changes. How can I solve this? Thanks.
>
> Joseph
>
> Il giorno 09/nov/2015, alle ore 10:41, Jens Erat <jens.erat(a)uni-konstanz.de> ha scritto:
>
> Hi Joseph,
>
> As far as I understand the documentation, BaseX `proc:system` does not
> use a shell interpreter by default. `<` or also the pipe `|` are
> features offered by your shell, not the operating system.
>
> Instead of passing a single parameter, pass the command as parameter to
> `/usr/bin/env sh -c`, which will make BaseX run a shell that interpretes
> I/O indirection:
>
> proc:system('/usr/bin/env', ('sh', '-c', 'opennlp postagger
> model.bin < file.txt'))
>
> This might be a reasonable thing to provide as a built-in function, I'm
> also not sure whether one can connect some kind of stream/strings to
> STDIN, STDOUT and STDERR.
>
> Regards from Lake Constance, Germany,
> Jens
>
> Am 09.11.2015 um 10:19 schrieb Christian Grün:
>>> Any suggestions?
>>
>> Any example? ;)
>> Christian
>>
>>
>>
>> Thanks.
>>>
>>> Joseph
>>>
>>>
>>> Inizio messaggio inoltrato:
>>>
>>> Da: meumapple <meumapple(a)gmail.com>
>>> Data: 06 novembre 2015 20:52:08 CET
>>> A: BaseX <basex-talk(a)mailman.uni-konstanz.de>
>>> Oggetto: Bash command
>>>
>>> Hi all,
>>>
>>> I am using proc:system for a bash command but I cannot run it. It looks like
>>> opennlp postagger model.bin < file.txt. I suspect that the problem is the
>>> less-than sign, which is converted into < Is there any way to keep the
>>> less-than sign and pass it to the bash properly? Thanks.
>>>
>>> Joseph
--
Jens Erat
Universität Konstanz
Kommunikations-, Infomations-, Medienzentrum (KIM)
Abteilung Basisdienste
D-78457 Konstanz
Mail: jens.erat(a)uni-konstanz.de