- 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;
- }
- }
+ 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;