Make debugger use utf8 by default
authorgggeek <giunta.gaetano@gmail.com>
Sun, 19 Apr 2015 21:59:55 +0000 (22:59 +0100)
committergggeek <giunta.gaetano@gmail.com>
Sun, 19 Apr 2015 21:59:55 +0000 (22:59 +0100)
NEWS
debugger/action.php
debugger/common.php
debugger/controller.php

diff --git a/NEWS b/NEWS
index 7f2c261..5062473 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -41,9 +41,6 @@ PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade.
 
 * improved: the testsuite has basic checks for the debugger and demo files
 
-* fixed: the debugger would fail sending a request with ISO-8859-1 payload (it missed the character set declaration).
-  It would have a hard time coping with ISO-8859-1 in other fields, such as e.g. the remote method name
-
 * fixed: the server would fail to decode a request with ISO-8859-1 payload and character set declaration in the xml prolog only
 
 * fixed: the client would fail to decode a response with ISO-8859-1 payload and character set declaration in the xml prolog only
@@ -52,6 +49,11 @@ PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade.
 
 * fixed: the client can now successfully call methods using ISO-8859-1 or UTF-8 characters in their name
 
+* fixed: the debugger would fail sending a request with ISO-8859-1 payload (it missed the character set declaration).
+  It would have a hard time coping with ISO-8859-1 in other fields, such as e.g. the remote method name
+
+* improved: the debugger is displayed using UTF-8, making it more useful to debug any kind of service
+
 * improved: echo all debug messages even when there are characters in them which php deems to be in a wrong encoding
   (this is visible e.g. in the debugger)
 
index c818429..3e22c69 100644 (file)
@@ -8,6 +8,9 @@
  * @todo use ob_start to catch debug info and echo it AFTER method call results?
  * @todo be smarter in creating client stub for proxy/auth cases: only set appropriate property of client obj
  **/
+
+header('Content-Type: text/html; charset=utf-8');
+
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -529,6 +532,7 @@ if ($action) {
 
     <h3>Changelog</h3>
     <ul>
+        <li>2015-04-19: fix problems with LATIN-1 characters in payload</li>
         <li>2007-02-20: add visual editor for method payload; allow strings, bools as jsonrpc msg id</li>
         <li>2006-06-26: support building php code stub for calling remote methods</li>
         <li>2006-05-25: better support for long running queries; check for no-curl installs</li>
index ea389a6..4026d60 100644 (file)
@@ -28,10 +28,11 @@ $preferredEncodings = 'UTF-8, ASCII, ISO-8859-1, UTF-7, EUC-JP, SJIS, eucJP-win,
 $inputcharset = mb_detect_encoding(urldecode($_SERVER['REQUEST_URI']), $preferredEncodings);
 if (isset($_GET['usepost']) && $_GET['usepost'] === 'true') {
     $_GET = $_POST;
-    /// @bug this is not a perfect detection method - it will fail if eg. a latin1 character is in the method name
-    $inputcharset = mb_detect_encoding(urldecode(isset($_GET['methodpayload'])) ? $_GET['methodpayload'] : '', $preferredEncodings);
+    $inputcharset = mb_detect_encoding(implode('', $_GET), $preferredEncodings);
 }
 
+/// @todo if $inputcharset is not UTF8, we should probably re-encode $_GET to make it UTF-8
+
 // recover input parameters
 $debug = false;
 $protocol = 0;
index e58d2a4..2fd4307 100644 (file)
@@ -13,7 +13,7 @@
  **/
 
 // make sure we set the correct charset type for output, so that we can display all characters
-//header('Content-Type: text/html; charset=utf-8');
+header('Content-Type: text/html; charset=utf-8');
 
 include __DIR__ . '/common.php';
 if ($action == '') {