# iconv's input_encoding useless?

- Thread: https://externals.io/message/13173
- Original archive: https://news-web.php.net/php.internals/13173
- Started by Michael Wallner on 2004-10-05T16:23:28+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13173 — Michael Wallner — 2004-10-05T16:23:28+00:00

URL: https://externals.io/message/13173#13173

Hi,

perhaps I'm just missing something, the docs don't
really mention anything about that issue...

Shouldn't iconv decode HTTP input from "input_encoding"
to "internal_encoding", and if not, then what is the 
input_encoding setting for?

Here's a small script to reproduce:
======================================================
<?php
iconv_set_encoding('internal_encoding', 'iso-8859-1');
iconv_set_encoding('input_encoding', 'utf-8');
iconv_set_encoding('output_encoding', 'utf-8');
ob_start('ob_iconv_handler');
?>
<form method="post" action="?">
	<input name="data" type="text">
	<input type="submit">
</form>
<hr>
<pre>
<?php
print_r($_POST);
foreach ($_POST as $k => $v) $_POST[$k] = iconv('utf-8', 'iso-8859-1', $v);
print_r($_POST);
?>
</pre>
======================================================

Many thanks,
-- 
Michael - < mike(@)php.net

---

## #13175 — Derick Rethans — 2004-10-05T17:20:03+00:00

URL: https://externals.io/message/13173#13175 · In reply to: #13173

> Hi,
>
> perhaps I'm just missing something, the docs don't
> really mention anything about that issue...
>
> Shouldn't iconv decode HTTP input from "input_encoding"
> to "internal_encoding", and if not, then what is the
> input_encoding setting for?
>
> Here's a small script to reproduce:

This can never reproduce it, as the request variables are parsed before
the script starts.  Besides that, I don't think that this setting is
indeed used at all.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #13176 — Michael Wallner — 2004-10-05T18:27:22+00:00

URL: https://externals.io/message/13173#13176 · In reply to: #13175

Hi Derick Rethans, you wrote:

> This can never reproduce it, as the request variables are parsed
> before the script starts.  Besides that, I don't think that this
> setting is indeed used at all.

Well ok, but setting this up in php.ini doesn't change anything...

Regards,
-- 
Michael - < mike(@)php.net

---

## #13189 — Moriyoshi Koizumi — 2004-10-06T01:50:46+00:00

URL: https://externals.io/message/13173#13189 · In reply to: #13173

Seems like a documentation problem. Since its introduction
the iconv extension has never had such a function that converts the
HTTP queries into those of another encoding, so that setting
is useless at all. But there is the opposite function that
converts the output into another encoding.

Could you file it in bugs.php.net?

Thanks
Moriyoshi



> Hi,
>
> perhaps I'm just missing something, the docs don't
> really mention anything about that issue...
>
> Shouldn't iconv decode HTTP input from "input_encoding"
> to "internal_encoding", and if not, then what is the
> input_encoding setting for?
>
> Here's a small script to reproduce:
> ======================================================
> <?php
> iconv_set_encoding('internal_encoding', 'iso-8859-1');
> iconv_set_encoding('input_encoding', 'utf-8');
> iconv_set_encoding('output_encoding', 'utf-8');
> ob_start('ob_iconv_handler');
> ?>
> <form method="post" action="?">
> 	<input name="data" type="text">
> 	<input type="submit">
> </form>
> <hr>
> <pre>
> <?php
> print_r($_POST);
> foreach ($_POST as $k => $v) $_POST[$k] = iconv('utf-8', 'iso-8859-1', 
> $v);
> print_r($_POST);
> ?>
> </pre>
> ======================================================
>
> Many thanks,
> -- 
> Michael - < mike(@)php.net
