+ /**
+ * RFC2184
+ * @param array $aParameters
+ * @return array
+ */
+ function processParameters($aParameters) {
+ $aResults = array();
+ $aCharset = array();
+ // handle multiline parameters
+ foreach($aParameters as $key => $value) {
+ if ($iPos = strpos($key,'*')) {
+ $sKey = substr($key,0,$iPos);
+ if (!isset($aResults[$sKey])) {
+ $aResults[$sKey] = $value;
+ if (substr($key,-1) == '*') { // parameter contains language/charset info
+ $aCharset[] = $sKey;
+ }
+ } else {
+ $aResults[$sKey] .= $value;
+ }
+ } else {
+ $aResults[$key] = $value;
+ }
+ }
+ foreach ($aCharset as $key) {
+ $value = $aResults[$key];
+ // extract the charset & language
+ $charset = substr($value,0,strpos($value,"'"));
+ $value = substr($value,strlen($charset)+1);
+ $language = substr($value,0,strpos($value,"'"));
+ $value = substr($value,strlen($charset)+1);
+ /* FIXME: What's the status of charset decode with language information ????
+ * Maybe language information contains only ascii text and charset_decode()
+ * only runs htmlspecialchars() on it. If it contains 8bit information, you
+ * get html encoded text in charset used by selected translation.
+ */
+ $value = charset_decode($charset,$value);
+ $aResults[$key] = $value;
+ }
+ return $aResults;
+ }
+
+ /**
+ * @param string $value
+ * @return array
+ */