*  Displays 65,536 characters.
 *  @author     Richard S. Mitchell
 *  @copyright  Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 

 *  Print $s with appended (Unix default) newline; prints just a newline if
 *  called without an argument.
 *  @param  string  $s
 *  @param  string  $os   (optional) m macintosh, w windows
 *  @return void
function println($s = '', $os = '')
  switch ($os) {
    case 'm':
      $newline = "\r";

    case 'w':
      $newline = "\r\n";

      $newline = "\n";


$page = 1;

extract($_GET, EXTR_IF_EXISTS);

println('<?xml version="1.0" encoding="UTF-8"?>');
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Display Character Set (Unicode)—page <?php print($page); ?></title>
    <style type="text/css">
      /* body {
        background-color: #B2B2B2;
        font-family: "Arial Unicode MS", Helvetica, Arial, sans-serif;
        margin: 9px;
      } */
      a {
        color: #3C9;
        text-decoration: none;
      a:visited {
        color: #C0734D;
      a:hover {
        color: #F96;
        text-decoration: underline;
      body {
        margin: 9px;
        background-color: #333;
        color: white;
        font-family: "Arial Unicode MS", Arial, Verdana, sans-serif;
        font-size: 14px;
      table {
        border-collapse: collapse;
        width: 702px;
      #pages_display {
        font-family: monospace;
        margin-bottom: 1em;
      #char_display td {
        width: 40px;
        height: 2em;
        border: solid gray 1px;
        text-align: center;
        font-size: 1em;
      #char_display th {
        font-family: Verdana;
      .clear {
        clear: both;
      #cc_msg {
        font-size: smaller;
        margin-top: 2em;
        text-align: center;
        width: 702px;
      #zoom_box {
        position: fixed;
        top: 36px;
        left: 750px;
        border: solid black 1px;
        padding: 12px 0;
        min-width: 180px;
        min-height: 180px;
        background-color: #E5E5E5;
        color: #333;
        text-align: center;
    <script type="text/javascript">
      var currentCell = "";

       *  Converts decimal number to hexadecimal string.
       *  @param  {int} d
       *  @return {mixed}   if d is a number then return hexadecimal string else return d
      function d2h(d)
        return (isNaN(d)) ? d : d.toString(16);

       *  Displays the clicked char in the zoom box;
      function zoom(n, cell)
        document.getElementById("zoom_box").innerHTML =
          "<span style=\"font-size: 100px;\">&#" + n + ";</span><br />" + n +
          "<br />" + d2h(n).toUpperCase();

        if (currentCell) {
          currentCell.style.backgroundColor = "#CCC";
          currentCell.style.color = "black";

        cell.style.color = "black";
        cell.style.backgroundColor = "#E5E5E5";
        currentCell = cell;
    // ]]>
    <div id="zoom_box">&nbsp;</div>
      Display Character Set (Unicode)—page <?php print($page); ?>
    <table border="0" cellspacing="0" cellpadding="0" id="pages_display">
          &nbsp; <a href="?page=1">1</a>
          &nbsp; <a href="?page=2">2</a>
          &nbsp; <a href="?page=3">3</a>
          &nbsp; <a href="?page=4">4</a>
          &nbsp; <a href="?page=5">5</a>
          &nbsp; <a href="?page=6">6</a>
          &nbsp; <a href="?page=7">7</a>
          &nbsp; <a href="?page=8">8</a>
          &nbsp; <a href="?page=9">9</a>
          &nbsp;<a href="?page=10">10</a>
          &nbsp;<a href="?page=11">11</a>
          &nbsp;<a href="?page=12">12</a>
          &nbsp;<a href="?page=13">13</a>
          &nbsp;<a href="?page=14">14</a>
          &nbsp;<a href="?page=15">15</a>
          &nbsp;<a href="?page=16">16</a><br />
          &nbsp;<a href="?page=17">17</a>
          &nbsp;<a href="?page=18">18</a>
          &nbsp;<a href="?page=19">19</a>
          &nbsp;<a href="?page=20">20</a>
          &nbsp;<a href="?page=21">21</a>
          &nbsp;<a href="?page=22">22</a>
          &nbsp;<a href="?page=23">23</a>
          &nbsp;<a href="?page=24">24</a>
          &nbsp;<a href="?page=25">25</a>
          &nbsp;<a href="?page=26">26</a>
          &nbsp;<a href="?page=27">27</a>
          &nbsp;<a href="?page=28">28</a>
          &nbsp;<a href="?page=29">29</a>
          &nbsp;<a href="?page=30">30</a>
          &nbsp;<a href="?page=31">31</a>
          &nbsp;<a href="?page=32">32</a><br />
          &nbsp;<a href="?page=33">33</a>
          &nbsp;<a href="?page=34">34</a>
          &nbsp;<a href="?page=35">35</a>
          &nbsp;<a href="?page=36">36</a>
          &nbsp;<a href="?page=37">37</a>
          &nbsp;<a href="?page=38">38</a>
          &nbsp;<a href="?page=39">39</a>
          &nbsp;<a href="?page=40">40</a>
          &nbsp;<a href="?page=41">41</a>
          &nbsp;<a href="?page=42">42</a>
          &nbsp;<a href="?page=43">43</a>
          &nbsp;<a href="?page=44">44</a>
          &nbsp;<a href="?page=45">45</a>
          &nbsp;<a href="?page=46">46</a>
          &nbsp;<a href="?page=47">47</a>
          &nbsp;<a href="?page=48">48</a><br />
          &nbsp;<a href="?page=49">49</a>
          &nbsp;<a href="?page=50">50</a>
          &nbsp;<a href="?page=51">51</a>
          &nbsp;<a href="?page=52">52</a>
          &nbsp;<a href="?page=53">53</a>
          &nbsp;<a href="?page=54">54</a>
          &nbsp;<a href="?page=55">55</a>
          &nbsp;<a href="?page=56">56</a>
          &nbsp;<a href="?page=57">57</a>
          &nbsp;<a href="?page=58">58</a>
          &nbsp;<a href="?page=59">59</a>
          &nbsp;<a href="?page=60">60</a>
          &nbsp;<a href="?page=61">61</a>
          &nbsp;<a href="?page=62">62</a>
          &nbsp;<a href="?page=63">63</a>
          &nbsp;<a href="?page=64">64</a>
    <table border="0" cellspacing="0" cellpadding="0" id="char_display">
        <th colspan="16" style="font-size: smaller; font-weight: normal; text-align: left;">
            (Click on character to view.)
$end = 1024 * $page;
$start = $end - 1024;
$line_length = 16;
$is1st = TRUE;
$td_format = '<td title="&amp;#%s;" onclick="zoom(%s, this);">&#%s;</td>';

for ($i = $start; $i < $end; $i++) {
  if (($i % $line_length) == 0) {
    if ($is1st) {
      $is1st = FALSE;
    else {
      println('      </tr>');
    println('      <tr>');
    print(sprintf('        <th>%s_</th>',
      strtoupper(str_pad(dechex($i / 16), 3, '0', STR_PAD_LEFT))));
  print(sprintf($td_format, $i, $i, $i));
    <p id="cc_msg">
      <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
        <img alt="Creative Commons License" style="border-width:0"
          src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a><br />
        <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource"
          property="dct:title" rel="dct:type">Display Character Set</span>
        by <a xmlns:cc="http://creativecommons.org/ns#" href="www.urchard.com/" property="cc:attributionName"
          rel="cc:attributionURL">Richard Mitchell</a> is licensed under a<br />
        <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
          Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License</a>.
    <script type="text/javascript">
      if (document.all) {
        // document.all.zoom_box.style.marginLeft = "24px";
    // ]]>