Hi Denis,
And thanks for response. Yes, I tried that too, but shouldn't it be
decodeURIComponent, as it surely is url-encoded already, I think?
To describe the prob in more detail, I'm developing a Desktop Gadget,
and the response from server is just a plain text string. No XML
involved. I tried to setRequestHeader("Content-Type", "text/plain;
charset=UTF-8") too, but it didn't help. If I use the encode_utf8() -
function below, the character shows as two upside down question marks,
and the item gets added in the list. And if I use the decode_utf8() -
function nothing shows up.
function encode_utf8( s )
{
return unescape( encodeURIComponent( s ) );
}
function decode_utf8( s )
{
return decodeURIComponent( escape( s ) );
}
Well, maybe the response has to be in properly encoded XML-format
then, I don't know. Guess I'll have to try that.
Timo
On 21 maalis, 23:44, Denis Maibaum <[email protected]> wrote:
> Hi Timo,
>
> I think I faced the same problem just yesterday.
> UFT-8 in gadget and MySQL database, with
> encoding errors for special characters.
>
> -> encodeURIComponent();
>
> solved the prob. for me, but I'm just the layout guy,
> and u tried all combinations ...
>
> good luck anyway! ;-)
>
> 2011/3/20 Timo <[email protected]>
>
> > Hello,
>
> > I'm making a gadget that queries a MySQL-database via XMLHttpRequest
> > and with a Php-page, and populates a listbox with the data. The
> > database is Utf-8 and all characters come through perfectly and I can
> > parse the data, except foreign chars (specifically the char รค) don't
> > show. When I populate the listbox, the item with that char gives an
> > error: ERROR: Couldn't parse XML and item doesn't show in list. I
> > think I've tried every combination of escapeing and encoding/decoding
> > too, but still no show. Everything from db to gadget should be in
> > Utf-8, so I don't see what could be the problem. I've previously and
> > successfully done an app which similarly queries a Db via Ajax and Php
> > (output goes to textarea), with rawurlencode on the Php side and
> > decodeURI & unescape on the script-side, but here the encoding
> > shouldn't be the issue I think.
>
> > Timo
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "iGoogle Developer Forum" 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/Google-Gadgets-API?hl=en.
--
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" 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/Google-Gadgets-API?hl=en.