<?php
ini_set("register_globals", "Off");
ini_set("track_vars", "On");
ini_set("output_buffering", "Off");
ini_set("mbstring.language", "Japanese");
ini_set("mbstring.internal_encoding", "EUC-JP" );
ini_set("mbstring.http_input" , "SJIS-win,EUC-JP,UTF-8,JIS");
ini_set("mbstring.http_output", "SJIS" );
ini_set("mbstring.detect_order", "SJIS-win,EUC-JP,UTF-8,JIS" );
ini_set("mbstring.encoding_translation", "On");
?>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>URL ENCODE TOOL</title>
</head>
<body>
<form action="" method="get">
<input type="hidden" name="mailto" value="1" />
<textarea name="q" style="width:300px;height:150px"></textarea>
<input type="submit" name="submit" value="submit" />
</form>
<?php
if ( get_magic_quotes_gpc() ) $_REQUEST["q"] = stripslashes($_REQUEST["q"]);
$str = (isset($_REQUEST["mailto"]))? mb_convert_encoding($_REQUEST["q"],"SJIS","auto"):$_REQUEST["q"];
$str8= (isset($_REQUEST["mailto"]))? mb_convert_encoding($_REQUEST["q"],"UTF-8","auto"):$_REQUEST["q"];
echo 'MODE: '.((isset($_REQUEST["mailto"]))?"MAIL2LINK":"NORMAL");
echo '<hr size="1" noshade="noshade" />';
echo "<strong>ORIGINAL STRING</strong>:<br />";
echo mb_convert_encoding($_REQUEST["q"],"EUC-JP","auto")."<br /><br />";
echo "<strong>URL ENCODED STRING(SJIS)</strong>:<br />";
echo urlencode($str)."<br /><br />";
echo "<strong>URL ENCODED STRING(UTF8)</strong>:<br />";
echo urlencode($str8)."<br /><br />";
?>
</body>
</html>