Decode a RESTXQ path
Friday, 28 August 2015 · 4 messages
KK
Kristian Kankainen28 Aug 2015 12:31 #
Hello!
I have a simplistic search path as %rest:GET
%rest:path("search/{$query}") for an application. It all works fine with ASCII query string, but I can't figure out how to decode the string when It contains utf-8 characters.
Best wishes
Kristian K
DK
Dirk Kirsten28 Aug 2015 12:43 #
Hello Kristian,
could you please elaborate what you mean by "decode"? Normally, you should not have to do anything, this is just an encoding and your $query variable should be able to handle UTF-8.
I just tested this to see if there might be a bug, but if I do e.g.
declare %rest:GET
%rest:path("test/{$query}")
%output:method("text")
function _:test(
$query as xs:string
) {
$query
}; and access it athttp://localhost/restxq/test/%F0%9F%98%83
I get back my intended smile face.
So it might help if you describe what does not work as you expect it to. Because we want you to have a smiley face as well ;)
Cheers
Dirk
PS: At other people asking on the mailing list, Christian is currently on vacation and I can't answer stuff I know next to nothing about (e.g. WebDAV). So please be patient.
Quoted text · Kristian Kankainen · 10 lines
On 08/28/2015 12:31 PM, Kristian Kankainen wrote: > Hello! > > I have a simplistic search path as %rest:GET > %rest:path("search/{$query}") for an application. It all works fine > with ASCII query string, but I can't figure out how to decode the > string when It contains utf-8 characters. > > Best wishes > Kristian K
--
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
KK
Kristian Kankainen28 Aug 2015 13:24 #
Hello!
I'll try to elaborate. :-)
My search function is as basic as is in your test. But you can see the output at:
http://tomcat.eki.ee/vadja/korpus/%F0%9F%98%83
Can it be a problem or setting of Tomcat or anything in between the browser and BaseX, for example Nginx?
Thank you for working your ass off while Christian is on vacation :-D Kristian K
28.08.2015 13:43 Dirk Kirsten kirjutas:
Quoted text · Dirk Kirsten · 46 lines
> Hello Kristian, > > could you please elaborate what you mean by "decode"? Normally, you > should not have to do anything, this is just an encoding and your > $query variable should be able to handle UTF-8. > > I just tested this to see if there might be a bug, but if I do e.g. > declare %rest:GET > %rest:path("test/{$query}") > %output:method("text") > function _:test( > $queryas xs:string > ) { > $query > }; and access it at > http://localhost/restxq/test/%F0%9F%98%83 > > I get back my intended smile face. > > So it might help if you describe what does not work as you expect it > to. Because we want you to have a smiley face as well ;) > > Cheers > Dirk > > PS: At other people asking on the mailing list, Christian is currently > on vacation and I can't answer stuff I know next to nothing about > (e.g. WebDAV). So please be patient. > > On 08/28/2015 12:31 PM, Kristian Kankainen wrote: >> Hello! >> >> I have a simplistic search path as %rest:GET >> %rest:path("search/{$query}") for an application. It all works fine >> with ASCII query string, but I can't figure out how to decode the >> string when It contains utf-8 characters. >> >> Best wishes >> Kristian K > > -- > Dirk Kirsten, BaseX GmbH,http://basexgmbh.de > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
DK
Dirk Kirsten28 Aug 2015 15:00 #
Hello Kristian,
I guess you are correct and Tomcat or nginx. I would guess that Tomcat is the culprit (but that might be totally biased, just because I had lots of trouble with Tomcat). However, you might want to follow the advice given at
https://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps to configure the server.xml
Also, to find out whats going on you could test accessing your page without a reverse proxy (so to see if nginx is causing the issue) and then with Jetty instead of Tomcat. jetty is our default HTTP server, so if you start basexhttp it will use Jetty.
Regards
Dirk
Quoted text · Kristian Kankainen · 64 lines
On 08/28/2015 01:24 PM, Kristian Kankainen wrote: > Hello! > > I'll try to elaborate. :-) > > My search function is as basic as is in your test. But you can see the > output at: > http://tomcat.eki.ee/vadja/korpus/%F0%9F%98%83 > > Can it be a problem or setting of Tomcat or anything in between the > browser and BaseX, for example Nginx? > > Thank you for working your ass off while Christian is on vacation :-D > Kristian K > > > 28.08.2015 13:43 Dirk Kirsten kirjutas: >> Hello Kristian, >> >> could you please elaborate what you mean by "decode"? Normally, you >> should not have to do anything, this is just an encoding and your >> $query variable should be able to handle UTF-8. >> >> I just tested this to see if there might be a bug, but if I do e.g. >> declare %rest:GET >> %rest:path("test/{$query}") >> %output:method("text") >> function _:test( >> $query as xs:string >> ) { >> $query >> }; and access it at >> http://localhost/restxq/test/%F0%9F%98%83 >> >> I get back my intended smile face. >> >> So it might help if you describe what does not work as you expect it >> to. Because we want you to have a smiley face as well ;) >> >> Cheers >> Dirk >> >> PS: At other people asking on the mailing list, Christian is >> currently on vacation and I can't answer stuff I know next to nothing >> about (e.g. WebDAV). So please be patient. >> >> On 08/28/2015 12:31 PM, Kristian Kankainen wrote: >>> Hello! >>> >>> I have a simplistic search path as %rest:GET >>> %rest:path("search/{$query}") for an application. It all works fine >>> with ASCII query string, but I can't figure out how to decode the >>> string when It contains utf-8 characters. >>> >>> Best wishes >>> Kristian K >> >> -- >> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
--
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Written for BaseX 8.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery