Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > testing/unicode.php
<%
	header("Content-Type: text/html; charset=utf-8");
	include_once( "../modules/utils.inc.php" );
	$tok =  $_COOKIE["c_pass_token"];
	$u   =  $sessionUserId = $_COOKIE["c_uid"];
	$id = $id ? $id : 21426;

	function ufix( $s ) {
		return preg_replace( "/%u([A-Fa-f0-9]{4})/", "&#x$1;", o( $s ) );
	}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title> Unicode Test Harness </title>
	<title>UTF8 ENCODER PAGE</title>
<%
	$code = get_magic_quotes_gpc() ? stripslashes( $GLOBALS[code] ) : $GLOBALS[code];
%>
</head>
<body>

<% if( $name ) { %>
	<p> [raw] name: <%= $name %> </p>
	<p> o( name ): <%= o( $name ) %> </p>
	<p> ufix( name ): <%= ufix( $name ) %> </p>
	<p> ufix( %usdf): <%= ufix( "%usdf" ) %> </p>
	<p> escapeQuotes( $argName): <%= escapeQuotes( $name) %> </p>
<% } %>

	<form method=post action="?seed=<?=time()?>">
		Original Unicode<br />
		<input name="code" value="<?=$code?>"><br />
	</form>

	<form>
		Encoded UTF8<br />
		<textarea name="encd" cols="80" rows="3"><%
	for( $i = 0; $i < strlen($code); $i++ ) {
		echo '&#' . ord(substr($code,$i,1)) . ';';
	}
%></textarea><br />
		<textarea name="RAWBUTCH" cols="80" rows="3"><%
	for( $i = 0; $i < strlen($code); $i++ ) {
		echo dechex( ord(substr($code,$i,1))) . " ";
	}
%></textarea><br />
	</form>

	<big>
		htmlentities(): <%= htmlentities( utf8_decode( "résumé" ), ENT_NOQUOTES, "UTF-8" ) %><br />
		htmlentities(): <%= htmlentities( utf8_decode( $code ), ENT_NOQUOTES, "UTF-8" ) %><br />
		o(): <%= o( utf8_decode( "fooâ„¢" ), ENT_NOQUOTES, "UTF-8" ) %><br />
		o(): <%= o( utf8_decode( $code ), ENT_NOQUOTES, "UTF-8" ) %><br />
		utf8_decode( ): <%= utf8_decode( "0xe284a2" ) %><br />
		chr( 0x6f ): <%= chr( 0x6f ) %><br />
		<%= hexdec( "f6" ) %><br />
		&#<%= hexdec( 2122 ) %>;
		&#<%= hexdec( 2019 ) %>;

		<hr />
		Armenian:<br />
			&#x0530;
			&#x0531;
			&#x0532;
			&#x0533;
			&#x058F;
			&#x0535;

			&#1329;
			&#1330;

		<hr />
	</big>

</body>
</html>
Return current item: FeedMeLinks, Social BookmarkingSince2002