Hi Fabian,
I have a problem with sending AJAX containing Hebrew language as my
response from server to client.
im my action I use:
$this->getResponse()->setHttpHeader("X-JSON", '('.$output.')');
$this->getResponse()->setHttpHeader('Content-Type','application/
json; charset=utf-8');
return sfView::HEADER_ONLY;
where $output is already formated as AJAX.
In my view I have a button, that executes the following javascript
function:
function refreshAds() {
divAppearance('adsProgress', false);
new Ajax.Updater('dummy', 'myAjaxActionURL',
{asynchronous:true, evalScripts:false,
onComplete:function(request, json)
{updateJSON(request, json)}, parameters:'someParams'})
}
function updateJSON(request, json) {
alert(json)
}
Now, everything works as expected when $output contains english.
When it contains Hebrew, I get a HokiPoki result.
If i print $output to the log in the action, and open it with notepad,
the hebrew looks fine, but I cannot get it to the other side...
to make it a less understood, when I put a hard-coded Hebrew string in
my JSON result, it did go fine to the other side, but only in IE... in
Firefox I have Jibrish.
any help would be welcomed, as I'm on it for some time already with no
real progress.
Many 10x, VYaron.
On Mar 11, 12:11 pm, "Fabian Lange" <[EMAIL PROTECTED]> wrote:
> Hi Andreas,
> You can shortcut this:
>
> In your action
>
> $this->getResponse()->setHttpHeader('Content-Type','application/json;
> charset=utf-8');
> return $this->renderText(json_encode($data));
>
> That automatic json decoding is part of prototype 1.6 and yes I think it
> could be nicely added to the ajax doc. I will file a reminder ticket on this
> .: Fabian
>
>
>
> -----Original Message-----
> From: Andreas Gehrke
> Sent: Dienstag, 11. März 2008 10:20
> To: symfony developers
> Subject: [symfony-devs] Re: Updating Prototype and Scriptaculous in 1.1
>
> I think its great symfony gets an updated prototype release. I have
> updated mine manually a couple of times.
>
> I have one small documentation issue. It would be great if the symfony
> docs mentioned that you can set content-type to application/json in
> your view.yml and use the responseJSON attribute on the request
> object, to get the JSON data returned from an Ajax action.
>
> view.yml:
> my-ajax-action:
> http_metas:
> content-type: application/json
>
> ajax-view-template.php:
> <?php echo json_encode($data); ?>
>
> ajax-using-template.php
> <script type="text/javascript">
> function ajax-complete(request)
> {
> data = request.responseJSON;
> // do something with data
> }
> </script>- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---