Use encodeURIComponent() instead of escape() in chatroom.js, to enable support for special characters and umlauts.
Patch attached.

Comments

pacheco’s picture

we will have to dig that a litlle deeper...

i've applied your patch im my install and it breaks some allready suported chars like "á", "é", "ç"...

maybe it needs some other changes to work well

Anonymous’s picture

Assigned: Unassigned »

hi stefan and paulo,

i tested stefan's patch on the latest cvs, and i is working as advertised.

paulo, this includes with the characters that aren't working for you - could retest at http://drupal.ceeceekay.net and see if you still have any problems?

if not, i'm going to make this change - thanks stefan.

cheers
justin

pacheco’s picture

really strange, its not working at all in my host, look:

http://dev.ppacheco.com/chatrooms/chat/3

maybe it depends on some else from server...

pacheco’s picture

ok, i've added utf8_decode in chatroomread.php, so this:

// are we writing?
  if ($write_request) {
    $msg       = strip_tags(urldecode($_POST['chatroomMsg']));
    $recipient = empty($_POST['recipient']) ? "" : $_POST['recipient'];

became:

// are we writing?
  if ($write_request) {
    $msg       = strip_tags(utf8_decode(urldecode($_POST['chatroomMsg'])));
    $recipient = empty($_POST['recipient']) ? "" : $_POST['recipient'];

and now it works for me, but i'm anger to rear someone explananing why it worked in your enviroment without this function and not in my.

still think it has something to do with the server config...

Anonymous’s picture

Status: Needs review » Fixed

i've committed a fix for this.

the javascript now uses encodeURIComponent(), and the php checks the value of get_magic_quotes_gpc() to decide whether to call utf8_decode, and it works fine either way.

thanks again stefan for the encodeURIComponent patch.

Anonymous’s picture

Status: Fixed » Active

Za pomocą tego formularza możesz wysłać mi mail. Jeśli wolisz kontakt przez telefon, Gadu-Gadu, Jabbera, Skype lub Tlen - podeślij swoje namiary i temat rozmowy, na pewno napiszę.
Ponieważ dostaję sporo maili z prośbą o pomoc przy problemach z instalacjami CMS, konfiguracją serwerów i komputerów, proszę o przeczytanie tej strony, zanim w tej sprawie napiszecie. Dzięki!

not sure what this says, but i got it from here, and it doesn't work in the chatroom at the moment.

we need to do some work on making these sorts of characters work with the chatroom.

any help is much appreciated.

Anonymous’s picture

i read through drupal.js a little more carefully, and it turns out that encodeUriComponent() is already called on the content we send back to the server.

sooo, the problem looks like being with mysql. on my install at home (mysql 5.0.22), setting the character type to utf8 fixed the problem. this is not an option for mysql versions less than 4.1 though, which is probably still the majority of users out there, so we need a fallback.

i'd like to spend some time on fixing this this weekend - suggestions anyone?

Anonymous’s picture

i've added some code to the install file that will set the default charset to utf8 if the mysql version is greater than 4.1.

this should fix display of multibyte chars for mysql greater than 4.1.

Anonymous’s picture

Assigned: » Unassigned
darren oh’s picture

Title: Use encodeURIComponent() instead of escape() » UTF8 not supported in MySQL versions before 4.1
Status: Active » Closed (won't fix)