File Unicode2html.php for phpCEDICT
<html> <head> <!-- charset=iso-8859-1 is important for the browser to convert the encoding --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Pinyin to Unicode Converter</title> </head> <body> <form action="unicode2html.php" method="post" name="convert"> <div class="PostTitle">Pinyin to Unicode Converter</div> <textarea name="text" cols="800" rows="7" id="text"></textarea> <br /> <input name="submit" type="submit" id="submit" value="Convert"> <input name="reset" type="reset" id="reset" value="Reset"> </form> <?php if (isset($_POST['submit'])) { //Below is what outputs the information, it assumes the existence //of header.html and footer.html, //you will need to modify it or delete it according to your needs. $toconvert=$_POST["text"]; $converted=$toconvert; //delete this //$converted=convert_to_unicode($toconvert); $converted = nl2br($converted); //echo("<div class='Post'>Unicode: <p>$converted</p>"); $convertedhtml=str_replace("&#","&#",$converted); //display the converted text as html echo ("Text for use in HTML:<p>$convertedhtml</p>"); } ?> </body> </html>
