Re: iconv returns blank string, not false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> why is this iconv function not working for me?  
> i am converting $search to euc-kr charset.....
> my conversion code is not working.
> 
> background and motivation
> --------------------
> i 	have to mimic a accept-charset on a form to fake a get request by
> disguising it as a hyperlink.  (my firefox refuses me tosend a remote
> post request from a win_open() [ al a javascript] function.
> 
> the accept-charset value is 'euc-kr'.
> 
> i threw in extra iconv_set_encoding to eliminate some problem there, but
> still no progress... :(
> 
> code
> ----------
> $xab = 1;
> $str_out =  mb_detect_encoding($search);
> $converted_search="ax";
> iconv_set_encoding("output_encoding", "EUC-KR");
> iconv_set_encoding("input_encoding", $str_out);
> if ($xab) echo " mb_detect_encoding***" . $str_out ."***search***
> $search***<br>";
> if ( function_exists('iconv') )   {
>     if ($str_out != 'euc-kr') {
>         if ($xab) var_dump( iconv_get_encoding('all'));
>         if ($xab) echo "iconv: \$converted_search***$converted_search***
> <br>";
>         $converted_search = iconv($str_out,"EUC-KR",$search);
>         if ($xab) echo "iconv: \$converted_search***$converted_search***
> <br>";
>     }
> }
> 
> 
> output (checks that search is proper and outputs "iconv_detect_encoding"
> and checks return from iconv function call)
> -----
> mb_detect_encoding***UTF-8***search***꺼다***
> array(3) { ["input_encoding"]=> string(5) "UTF-8" ["output_encoding"]=>
> string(6) "EUC-KR" ["internal_encoding"]=> string(10) "ISO-8859-1" }
> iconv: $converted_search***ax*** 
> iconv: $converted_search******
> 
> many blessings to all.
> merry chirstmas.

this works for some utf8 words coming in.
strange, also, if i var_dump($converted_search) it says
---->    string(4) ""
but it is completely empty for all other purposes.

by the way, is this the correct way to send an encoded value over the
internet for a href tag, as a get request?

the $converted_search is what is output from the iconv functions....

<center><h3>search from <a
href='http://nlpweb.kaist.ac.kr/Urimal/find_word.php?kt_word=\";<?php
echo
$converted_search; ?>\"&cs=ksc'>http://nlpweb.kaist.ac.kr/Urimal/</a></h3></center>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux