Solved

processing unicode_ form submission

Posted on 2004-09-17
3
159 Views
Last Modified: 2010-03-05
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
Comment
Question by:serg111
  • 2
3 Comments
 
LVL 18

Expert Comment

by:kandura
ID: 12089400
does your script "use CGI;" ?
is "unicode" an appropriate value for charset?
does your webserver serve this document with that same charset?
0
 
LVL 2

Author Comment

by:serg111
ID: 12089650
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
 
LVL 18

Accepted Solution

by:
kandura earned 250 total points
ID: 12091119
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now