AJASON
Home | Downloads | Getting Started | Options | Examples | Character Encoding | Bugs
Digg it    del.icio.us    Blink it

Character encoding
The third party (http://mike.teczno.com/json.html) PHP JSON library which AJASON is using requires all strings to be encoded in UTF-8. Thus since version 0.9 AJASON provides the option Ajax::EncodeOption. If set to true the return value of the method or function which has been called by the client will be encoded to UTF-8 before passed back to the client. If told to, AJASON takes care of plain strings, strings in arrays and strings in objects. Because the function utf8_encode (http://www.php.net/manual/en/function.utf8-encode.php) is being used for the conversion, strings need to be returned in ISO-8859-1 encoding first.

This leaves us with two options:
  1. Make sure the return value contains strings in ISO-8859-1 and enable Ajax::EncodeOption or
  2. Don't use Ajax::EncodeOption and encode the strings into UTF-8 yourself before returning them