I have a cgi script in which the query string has both English characters and Greek characters. For example, the user may enter in the input box Matt1/??? When the url with the query string is sent to the server (I am using Molly Brown the server and amfora as a client) it is changed the Greek characters using url encoding. I am wondering how to I decode the url to get back the Greek characters. I am using bash for my scripts. Thank you.
On 3/3/2021 6:57 PM, Rev. Fr. Robert Bower wrote: > I have a cgi script in which the query string has both English > characters and Greek characters. > > For example, the user may enter in the input box Matt1/??? > > When the url with the query string is sent to the server (I am using > Molly Brown the server and amfora as a client) it is changed the Greek > characters using url encoding. > If that's actually what the server is sending back to you then you might want to consider: https://tildegit.org/solderpunk/molly-brown/issues -- Bradley D. Thornton Manager Network Services http://NorthTech.US TEL: +1.310.421.8268
On Wed, Mar 03, 2021 at 09:57:07PM -0500, Rev. Fr. Robert Bower <frrobert at frrobert.com> wrote a message of 38 lines which said: > When the url with the query string is sent to the server (I am using > Molly Brown the server and amfora as a client) it is changed the > Greek characters using url encoding. > > I am wondering how to I decode the url to get back the Greek > characters. I am using bash for my scripts. The server (MollyBrown) should do it for you :-( but if it doesn't, in bash, you have several solutions: https://gist.github.com/cdown/1163649 https://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding https://unix.stackexchange.com/questions/57519/how-to-replace-all-percent-e ncoded-utf-8-substrings-with-plain-utf-8-text
Rev. Fr. Robert Bower <frrobert at frrobert.com> writes: > I have a cgi script in which the query string has both English characters and Greek characters. > > For example, the user may enter in the input box Matt1/??? > > When the url with the query string is sent to the server (I am using Molly Brown the server and amfora as a client) it is changed the Greek characters using url encoding. > > I am wondering how to I decode the url to get back the Greek characters. I am using bash for my scripts. > > Thank you. One way to decode using plain sh scripts is to substitute each % with \x and pass the string to printf, but I don't know how solid it can be in the real world $ QUERY_STRING='caf%C3%A8' $ printf '%b\n' $(printf "%s\n" "$QUERY_STRING" | sed 's/%/\\x/g') caf? Or you can shell out to python, ruby, perl, etc... that have libraries to do the decoding. Cheers,
Stephane Bortzmeyer <stephane at sources.org> writes: > On Wed, Mar 03, 2021 at 09:57:07PM -0500, > Rev. Fr. Robert Bower <frrobert at frrobert.com> wrote > a message of 38 lines which said: > >> When the url with the query string is sent to the server (I am using >> Molly Brown the server and amfora as a client) it is changed the >> Greek characters using url encoding. >> >> I am wondering how to I decode the url to get back the Greek >> characters. I am using bash for my scripts. > > The server (MollyBrown) should do it for you :-( but if it doesn't, in > bash, you have several solutions: AFAIK that's not correct. gmid was doing exactly that, and after talking to Sean that raised some doubts about my CGI implementation (for this and other details), I re-checked the RFC3875[0] and it effectively requires QUERY_STRING to be url-encoded: > 4.1.7. QUERY_STRING > > The QUERY_STRING variable contains a URL-encoded search or parameter > string; [0]: gemini://tanso.net/rfc/rfc3875.txt
Thank you to everyone for their help. Search using Greek letters now works. Here is a link to my Gemini site for those interested gemini://frrobert.net Here is the link to the search tool you help fix. gemini://frrobert.net/sblintro.gmi On Wed, Mar 03, 2021 at 09:57:07PM -0500, Rev. Fr. Robert Bower wrote: >I have a cgi script in which the query string has both English characters and Greek characters. > >For example, the user may enter in the input box Matt1/??? > >When the url with the query string is sent to the server (I am using Molly Brown the server and amfora as a client) it is changed the Greek characters using url encoding. > >I am wondering how to I decode the url to get back the Greek characters. I am using bash for my scripts. > >Thank you. > > -- In Christ, Rev. Fr. Robert Bower St. Nectarios Orthodox Church (Russian Orthodox Church Outside of Russia) http://www.stnectarios.org 574-850-7982 For we preach not ourselves, but Christ Jesus the Lord; and ourselves your servants for Jesus' sake. (2 Cor 4:5) KJV
---
Previous Thread: Just a warning about https://www.protocolgemini.com/