Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

processing unicode_ form submission

I am using following form to submit unicode data with 2 russian characters in "rus_lang" field.

<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
</HEAD><BODY>
<FORM action=http://209.45.33.8/cgi-bin/cgiwrap/absolute/WRITEENV.CGI method=post>
<INPUT type=text name=rus_lang value="Ce">
<INPUT type=submit value="Submit">
</FORM>
</BODY></HTML>


When I processing this form submission with Perl script I receive following string as input:
rus_lang=%D0%A1%D0%B5

How can I decode that received string to original value (that was : rus_lang="\x21\x04\x35\x04" )

P.S. Form example above cant show russian characters on this web site :-(
So I changed 2 russian characters to 2 english character to give an idea how it looks like
0
serg111
Asked:
serg111
  • 2
1 Solution
 
kanduraCommented:
does your script "use CGI;" ?
is "unicode" an appropriate value for charset?
does your webserver serve this document with that same charset?
0
 
serg111Author Commented:
1) No, it use plain Perl
2) Yes, it is used by microsoft and other prividers
3) Yes, this web page above is from same webserver
0
 
kanduraCommented:
1) then do use CGI, since it will do the decoding for you.
2) unicode is not a registered value for charset. See http://www.iana.org/assignments/character-sets for a complete list
3) what I mean is, does your webserver also emit a HTTP header stating
    Content-type: text/html; charset=unicode

It probably doesn't. You should consider using an accepted encoding such as utf-8 or ISO-8859-1.

Just for fun I tried running the W3C Validator on a script that sets the charset to "unicode". The result is enlightening:
    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.spiritofamerica.net%3A8080%2Fcgi-bin%2Fsoa%2Ftest.pl&charset=%28detect+automatically%29&doctype=%28detect+automatically%29&verbose=1

Other recommended reading: http://www.cs.tut.fi/~jkorpela/chars.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now