Changeset 520
- Timestamp:
- 04/14/07 17:27:10 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/processors/stubJsonRpcProcessor.php
r519 r520 13 13 'net.stubbles.reflection.reflection', 14 14 'net.stubbles.service.annotations.stubWebMethodAnnotation', 15 'net.stubbles.service.stubStatefulService'); 15 'net.stubbles.service.stubStatefulService', 16 'net.stubbles.util.encoding.stubEncodingHelper'); 16 17 17 18 /** … … 259 260 $fault = array( 260 261 'id' => $reqId, 261 'error' => utf8_encode($message)262 'error' => stubEncodingHelper::recursiveUtf8Encode($message) 262 263 ); 263 264 $faultEncoded = json_encode($fault); … … 274 275 $response = array( 275 276 'id' => $reqId, 276 'result' => $this->recursiveUtf8Encode($result)277 'result' => stubEncodingHelper::recursiveUtf8Encode($result) 277 278 ); 278 279 $responseEncoded = json_encode($response); 279 280 $this->response->write($responseEncoded); 280 281 } 281 282 /**283 * Encode the response in UTF-8284 *285 * @param mixed $value286 * @return mixed287 * @todo add support for objects288 */289 protected function recursiveUtf8Encode($value) {290 if (is_string($value)) {291 return utf8_encode($value);292 }293 if (is_array($value)) {294 foreach ($value as $key => $val) {295 $value[$key] = $this->recursiveUtf8Encode($val);296 }297 }298 return $value;299 }300 282 } 301 283 ?>
