<-- back to the mailing list

Greek characters in query string

Omar Polo op at omarpolo.com

Thu Mar 4 07:50:06 GMT 2021

- - - - - - - - - - - - - - - - - - - 

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 \xand pass the string to printf, but I don't know how solid it can be inthe 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 librariesto do the decoding.

Cheers,