Make debugger use utf8 by default
[plcapi.git] / debugger / common.php
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;