473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cannot get the korean value that was posted to CGI

CASE-1: From a CGI window, when I open another CGI window using window.open() and post a korean value [ encoded using Javascript encodeURI() ] through the URL, and then if I read the input using PERL from
STDIN, I dont receive the original Korean string. I see some junk content.

CASE-2: On the other side, if I post the Korean value [ encoded with EUC_KR ] using Java to the same CGI window, I could get my original Korean string from the PERL STDIN. In this case, I am before posting
it to the CGI.

For the both the above cases the web server used is Apache (2.0.54)
Is there any way to resolve CASE-1?
Nov 12 '06 #1
4 1765
CASE-1: From a CGI window, when I open another CGI window using window.open() and post a korean value [ encoded using Javascript encodeURI() ] through the URL, and then if I read the input using PERL from
STDIN, I dont receive the original Korean string. I see some junk content.

CASE-2: On the other side, if I post the Korean value [ encoded with EUC_KR ] using Java to the same CGI window, I could get my original Korean string from the PERL STDIN. In this case, I am before posting
it to the CGI.

For the both the above cases the web server used is Apache (2.0.54)
Is there any way to resolve CASE-1?
Nov 12 '06 #2
GunnarH
83
Without code, that illustrates the problem, it's hard to understand what you mean. But the document, from which you submit the form with Korean characters, should better have the content-type text/html; charset=EUC_KR.
Nov 12 '06 #3
I am using PERL 5.6 for CGI (Server script).
When a query string containing Korean values is POSTed, the following code gives me the values in ANSI form.
As a result, the I get junk values.
My problem is to read these Korean values properly and not as junk.

Expand|Select|Wrap|Line Numbers
  1. if ($ENV{'REQUEST_METHOD'} eq 'POST') {
  2.     read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
  3. }
  4. else {
  5.     $buf=$ENV{'QUERY_STRING'};
  6. }
  7.  
  8. @fval=split(/&/,$buf);
  9. foreach $i (0 .. $#fval){
  10.     ($name,$val)=split (/=/,$fval[$i],2);
  11.     $val=~tr/+/ /;
  12.     $val=~ s/%(..)/pack("c",hex($1))/ge;
  13.     $name=~tr/+/ /;
  14.     $name=~ s/%(..)/pack("c",hex($1))/ge;
  15.  
  16.     if (!defined($field{$name})) {
  17.         $field{$name}=$val;
  18.     }
  19.     else {
  20.         $field{$name} .= ",$val";
  21.     }
  22. }
Nov 13 '06 #4
GunnarH
83
When a query string containing Korean values is POSTed, the following code gives me the values in ANSI form.
As a result, the I get junk values.
I don't know very much about working with Korean characters, but I have a strong feeling that you are not supposed to use them directly anywhere in a URL. What you can do is including the URI escaped equivalent of the octets that represent the Korean string.

Please consider the following script:
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. $ENV{QUERY_STRING} = 'kr_string=%B6%F3%C0%CC%C7%C1%C0%CE%C4%DA%B8%AE%BE%C6';
  4.  
  5. use CGI;                 # Note that these three
  6. my $cgi = CGI->new;      # lines replace all the
  7. my %field = $cgi->Vars;  # code you posted
  8.  
  9. print $cgi->header(-type=>'text/plain', -charset=>'EUC-KR');
  10. print "kr_string: $field{kr_string}\n";
Nov 14 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nicholas Pappas | last post by:
Hello all. I'm still having some trouble with getting Java work its way through Korean directories and filenames. I was able to load the strings in properly (using Cp1252 as the charset), and...
14
by: Erik Bethke | last post by:
Hello All, I am getting an error of not well-formed at the beginning of the Korean text in the second example. I am doing something wrong with how I am encoding my Korean? Do I need more of a...
7
by: Erik Bethke | last post by:
Hello All, I have found much help in the google archives but I am still stuck... here is my code snippet: path = os.getcwd() path = path.decode('UTF8') Now the trouble is I am getting that...
0
by: Harshal | last post by:
Hi all, we are trying to load Korean data from a Excel Sheet in to Oracle Database (8.1.7.3 with NLS_LANG=American_America.UTF8) We successfully transferred the Unicode file to our Unix...
1
by: rhompi | last post by:
Hi, I have a problem displaying korean characters in javascript alerts. Korean characters are displayed fine in menus, webpages, buttons,etc. except in javascript alerts. Can anyone please help...
0
by: Darin | last post by:
I have the following routines: Public Function DecryptText(ByVal in_text As String) As String Dim strKey As String = "ROCK" Dim i As Integer Dim c As Integer Dim out_buff As String For i =...
0
by: joseph speigle | last post by:
hi, To see the query results in native language see http://database.sarang.net/?inc=read&aid=5368&criteria=pgsql&subcrit=qna&id=&limit=20&keyword=&page=1 the simpler url is ...
0
by: jin | last post by:
Hi ! To download file, I use the following < My code > // encode non-ASCII Filename string filename = Server.UrlEncode("the korean filename"); Response.AppendHeader("Content-Disposition" ,...
0
by: kumarpl | last post by:
CASE-1: From a CGI window, when I open another CGI window using window.open() and post a korean value through the URL, and then if I read the input using PERL from STDIN, I dont receive the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.