From d895b852a6e160496ffc760d46d3719a3d62ff86 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sun, 3 Feb 2008 23:23:24 +0000 Subject: Initial checkin of nutridb.org and basic subversion directory structure --- lib/xajax_0.2.4/tests/charEncodingTest.php | 130 +++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 lib/xajax_0.2.4/tests/charEncodingTest.php (limited to 'lib/xajax_0.2.4/tests/charEncodingTest.php') diff --git a/lib/xajax_0.2.4/tests/charEncodingTest.php b/lib/xajax_0.2.4/tests/charEncodingTest.php new file mode 100644 index 0000000..e2a4c8c --- /dev/null +++ b/lib/xajax_0.2.4/tests/charEncodingTest.php @@ -0,0 +1,130 @@ +addAlert("Your options have been saved."); + return $objResponse; +} + +function testForm($strText, $formData, $arrArray) +{ + global $useEncoding, $htmlEntities; + $objResponse = new xajaxResponse($useEncoding, $htmlEntities); + $data = "Text:\n" . $strText; + $data .= "\n\nFormData:\n" . print_r($formData, true); + $data .= "\n\nArray:\n" .print_r($arrArray, true); + $objResponse->addAlert($data); + $objResponse->addAssign("submittedDiv", "innerHTML", "
".$data."
"); + return $objResponse->getXML(); +} + +$useEncoding = "UTF-8"; +$htmlEntities = false; +$decodeUTF8 = false; + +session_start(); +session_name("xajaxCharEncodingTest"); + +if (@$_GET['refresh'] == "yes") { + session_destroy(); + header("location: charEncodingTest.php"); + exit(); +} + +if (isset($_SESSION['useEncoding'])) { + $useEncoding = $_SESSION['useEncoding']; +} +if (isset($_SESSION['htmlEntities'])) { + $htmlEntities = $_SESSION['htmlEntities']; +} +if (isset($_SESSION['decodeUTF8'])) { + $decodeUTF8 = $_SESSION['decodeUTF8']; +} + +$xajax = new xajax(); +$xajax->setCharEncoding($useEncoding); +if ($htmlEntities) { + $xajax->outputEntitiesOn(); +} +if ($decodeUTF8) { + $xajax->decodeUTF8InputOn(); +} +//$xajax->debugOn(); +$xajax->registerFunction("setOptions"); +$xajax->registerFunction("testForm"); +$xajax->processRequests(); +?> + + + +Character Encoding Test | xajax Tests +printJavascript("../") ?> + + + + +

xajax Tests

+

Character Encoding Test

+ +

Options Form

+ +

NOTE: if you change these options, make sure you click the Save Options button or the options won't be used.

+ +
+

Encoding:
+Output HTML Entities? /> Yes + /> No
+Decode UTF-8 Input? /> Yes + /> No
+

+
+ +

Clear and Refresh

+ +

Text Test Form

+ +

Here are some Unicode examples you can paste into the text box below. You can see more examples and a list of standard encoding schemes here.

+ +
+

+

+
+ +
+
+ + + \ No newline at end of file -- cgit v1.2.3