Encoding problem with proc:system
Sunday, 14 January 2018 · 4 messages · last reply 15 Jan 2018
KK
Kristian Kankainen14 Jan 2018 08:28 #
Hello all,
I am running a system command with
proc:system. The command should return xml, but because of non-ascii letters, the returned string gets scrambled. (I am aware that proc:system receives a string, proc:execute returns an element.)
Running the system command in a shell works fine, I get this (snippet)<element>aapõ</element>When running the command through
proc:system, I get this instead<element>aap....lement>Where the õ (= C3 B5 in hex representation) has been replaced with F5 BC AF B0.
I get the same result specifying the encoding option of
proc:system with "utf-8" or just leaving blank. My shell uses utf-8.
How could I find out what encoding I need to use in the proc:system function?
Best regards,
Kristian KKK
Kristian Kankainen14 Jan 2018 08:56 #
I changed the encoding option to "latin1" and now
proc:system works fine.
Does this mean my system's encoding is latin1?
Best regards,
Kristian K
14.01.2018 09:28 Kristian Kankainen kirjutas:Quoted text · Kristian Kankainen · 27 lines
> Hello all, > > I am running a system command with proc:system. The command should > return xml, but because of non-ascii letters, the returned string gets > scrambled. (I am aware that proc:system receives a string, > proc:execute returns an element.) > > Running the system command in a shell works fine, I get this (snippet) > > <element>aapõ</element> > > When running the command through proc:system, I get this instead > > <element>aap....lement> > > Where the õ (= C3 B5 in hex representation) has been replaced with F5 > BC AF B0. > > I get the same result specifying the encoding option of proc:system > with "utf-8" or just leaving blank. My shell uses utf-8. > > How could I find out what encoding I need to use in the proc:system > function? > > Best regards, > Kristian K >
CG
Christian Grün15 Jan 2018 13:26 #
Hi Kristian,
I remember there has been some feedback on the Process Module and the encoding argument. Did you already compare the behavior with the latest snapshot [1]?
Best,
Christian
[1] http://files.basex.org/releases/latest/
Quoted text · Kristian Kankainen · 41 lines
On Sun, Jan 14, 2018 at 8:56 AM, Kristian Kankainen <kristian at keeleleek.ee> wrote: > I changed the encoding option to "latin1" and now proc:system works fine. > > Does this mean my system's encoding is latin1? > > Best regards, > Kristian K > > > > 14.01.2018 09:28 Kristian Kankainen kirjutas: >> >> Hello all, >> >> I am running a system command with proc:system. The command should return >> xml, but because of non-ascii letters, the returned string gets scrambled. >> (I am aware that proc:system receives a string, proc:execute returns an >> element.) >> >> Running the system command in a shell works fine, I get this (snippet) >> >> <element>aapõ</element> >> >> When running the command through proc:system, I get this instead >> >> <element>aap....lement> >> >> Where the õ (= C3 B5 in hex representation) has been replaced with F5 BC >> AF B0. >> >> I get the same result specifying the encoding option of proc:system with >> "utf-8" or just leaving blank. My shell uses utf-8. >> >> How could I find out what encoding I need to use in the proc:system >> function? >> >> Best regards, >> Kristian K >> >
KK
Kristian Kankainen15 Jan 2018 14:03 #
Hi,
I put this on my todo list and will answer later.
Thank you,
Kristian K
15.01.2018 14:26 Christian Grün kirjutas:
Quoted text · Christian Grün · 52 lines
> Hi Kristian, > > I remember there has been some feedback on the Process Module and the > encoding argument. Did you already compare the behavior with the > latest snapshot [1]? > > Best, > Christian > > [1] http://files.basex.org/releases/latest/ > > > > On Sun, Jan 14, 2018 at 8:56 AM, Kristian Kankainen > <kristian at keeleleek.ee> wrote: >> I changed the encoding option to "latin1" and now proc:system works fine. >> >> Does this mean my system's encoding is latin1? >> >> Best regards, >> Kristian K >> >> >> >> 14.01.2018 09:28 Kristian Kankainen kirjutas: >>> Hello all, >>> >>> I am running a system command with proc:system. The command should return >>> xml, but because of non-ascii letters, the returned string gets scrambled. >>> (I am aware that proc:system receives a string, proc:execute returns an >>> element.) >>> >>> Running the system command in a shell works fine, I get this (snippet) >>> >>> <element>aapõ</element> >>> >>> When running the command through proc:system, I get this instead >>> >>> <element>aap....lement> >>> >>> Where the õ (= C3 B5 in hex representation) has been replaced with F5 BC >>> AF B0. >>> >>> I get the same result specifying the encoding option of proc:system with >>> "utf-8" or just leaving blank. My shell uses utf-8. >>> >>> How could I find out what encoding I need to use in the proc:system >>> function? >>> >>> Best regards, >>> Kristian K >>>
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery