tags:

views:

11

answers:

1

I created a simple comment wall that submits using ajax.

Using javascript i collect user input:

var sharetxt =  encodeURIComponent(document.getElementById("cw_share_txt").value);

then pass it to a php page, on the php page, i collect the passed data:

$text=nl2br(htmlentities(trim(utf8_decode($_POST["txt"]))));

Encoding of the php page above:

header("Content-Type: text/xml; charset=utf-8");

My problem is that

  1. the wall doesnt still support multi languages (displays as ???? and causes my xml not to work)

  2. i still problems with some special characters (displays as � or ?)

What am i not doing right? please assist

A: 

The magic left when you called utf8_decode. Did you have a good reason for doing that? Also, shouldn't your page be XHTML instead of true XML?

Borealid
i used the utf8_decode when i was having issues with passing the xml back to javascript (xml was complaining of some unknown xters). the xml im talkin bout here is in my php process page.
Ogugua Belonwu
@Ogugua Belonwu: If you call `utf8_decode`, you strip all the characters that don't fit in ISO-8859-1 from the document. That's no good. I don't know the correct function for putting arbitrary UTF-8 into XML, but that's not it.
Borealid
i have removed the utf_decode and it doesnt still display right eg. '(Hydrog�ologie, 1802).[4][5] It was inspired by the Greek word ????, bios, "life" and the suffix -?????, -logia, "study of' instead of ' (Hydrogéologie, 1802).[4][5] It was inspired by the Greek word βίος, bios, "life" and the suffix -λογία, -logia, "study of'
Ogugua Belonwu