Hi again, I''m trying to load a PHP document with AJAX that contains special characters like ä, ö. Altough I have utf-8, these signs are only replaced by a question mark. My server settings seem to be correct, these signs normally work. I''ve explicitly defined charset=utf-8 in the PHP-document header, but it did not help. Could anyone please show me the correct way and syntax to take care about this? Thanks in advance, Mickster --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
When dealing with these sorts of things - I''ve had to do it on several
websites - I ''escape'' the characters when I send them out
using rawurlencode
then unescape them in JavaScript.
PHP:
<?
//something in french with an accented character:
echo rawurlencode("Par catégorie");
?>
Javascript:
$(''destination'').update(unescape(t.responseText));
Hope this helps,
Jon
On 9/13/07, Mickster
<micael.gustafsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> Hi again,
>
> I''m trying to load a PHP document with AJAX that contains special
> characters like ä, ö.
> Altough I have utf-8, these signs are only replaced by a question
> mark.
>
> My server settings seem to be correct, these signs normally work.
>
> I''ve explicitly defined charset=utf-8 in the PHP-document header,
but
> it did not help.
>
> Could anyone please show me the correct way and syntax to take care
> about this?
>
> Thanks in advance,
> Mickster
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I''m using this combinaison in my app (french) :
header ("Content-Type: text/html; charset=ISO-8859-1"); // PHP
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=ISO-8859-1" /> <!-- HTML -->
for my HTML content, and
header ("Content-Type: application/xml; charset=UTF-8"); // PHP
<?xml version="1.0" encoding="ISO-8859-1"
standalone="yes" ?>
for my XML content.
The only characters to be encoded in the XML are the basic XML tags :
&, <, and >
In both HTML and XML, all characters (except the mentionned XML chars)
can be echo''ed without special treatement.
Some people will use UTF-8 all the way, but I always ran into
problems. This is the only setting that I found working without
problems so far (2 years now). If you have a database connection, the
encoding of you tables can be latin1, and everything''s good.
Cheers.
yanick
On 13 sep, 07:27, Mickster
<micael.gustafs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi again,
>
> I''m trying to load a PHP document with AJAX that contains special
> characters like ä, ö.
> Altough I have utf-8, these signs are only replaced by a question
> mark.
>
> My server settings seem to be correct, these signs normally work.
>
> I''ve explicitly defined charset=utf-8 in the PHP-document header,
but
> it did not help.
>
> Could anyone please show me the correct way and syntax to take care
> about this?
>
> Thanks in advance,
> Mickster
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Jon & Yanick >> Thanks a lot for your quick answers! Looks good, I''ll give it a try! Thanks again! Best Regards, Mickster On Sep 13, 2:12 pm, Yanick <yanick.roc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using this combinaison in my app (french) : > > header ("Content-Type: text/html; charset=ISO-8859-1"); // PHP > <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; > charset=ISO-8859-1" /> <!-- HTML --> > > for my HTML content, and > > header ("Content-Type: application/xml; charset=UTF-8"); // PHP > <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> > > for my XML content. > > The only characters to be encoded in the XML are the basic XML tags : > &, <, and > > > In both HTML and XML, all characters (except the mentionned XML chars) > can be echo''ed without special treatement. > > Some people will use UTF-8 all the way, but I always ran into > problems. This is the only setting that I found working without > problems so far (2 years now). If you have a database connection, the > encoding of you tables can be latin1, and everything''s good. > > Cheers. > > yanick > > On 13 sep, 07:27, Mickster <micael.gustafs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi again, > > > I''m trying to load a PHP document with AJAX that contains special > > characters like ä, ö. > > Altough I have utf-8, these signs are only replaced by a question > > mark. > > > My server settings seem to be correct, these signs normally work. > > > I''ve explicitly defined charset=utf-8 in the PHP-document header, but > > it did not help. > > > Could anyone please show me the correct way and syntax to take care > > about this? > > > Thanks in advance, > > Mickster--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---