Skip to Content Skip to Menu

(SOLVED+FIX) Realnames character encoding bug

  • bbence
  • bbence
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
16 years 7 months ago #60725 by bbence
Hi there!

First of all, great component, awesome features! It greatly helps (or will help, to be exact) my community site to be really useful.
There's a slight bug I observed. When using realnames setting to display the names there's some kind of encoding error: the names with some not so common characters don't appear correctly and then the message can't be sent. I tried changing the Used charset setting to UTF-8 for example, but it doesn't work. An example:
the real name of a user is: Bertalan Győző. But uddeIM display this when trying to send a message in the name field: Bertalan GyÅ�zÅ�.

How can this be corrected?

Thanks in advance! And once again, good job! :)

Post edited by: slabbi, at: 2008/05/07 12:39

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
16 years 7 months ago #60729 by slabbi
Replied by slabbi on topic Re:Realnames character encoding bug
bbence wrote:

the real name of a user is: Bertalan Győző. But uddeIM display this when trying to send a message in the name field: Bertalan GyÅ�zÅ�.

How can this be corrected?

Thanks in advance! And once again, good job! :)


Usually it should work with J1.0 and J1.5. But when problems appears you should check
- the encoding of characters in the database
- the encodung used to connect to the database
- the encoding used in the template

The function uddeIM offers in the system tab does only select the correct encoded language file. So it has nothing to do with the AJAX request. uddeIM reads the data from the DB and uses rawurlencode to encode them:

Check uddeIMcompleteUserName in uddeim.php:
$items[] = rawurlencode($item->displayname);

This is unencoded in uddeIMdoAutocomplete in include.php:
choice = unescape(choice);

You could try to remove "rawurlencode" so it is
$items[] = $item->displayname;
but in my opinion there is a problem somewhere else so the characters are encoded (either to utf-8 or from utf-8) maybe because of a wrong character encoding used to connect to your database.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
16 years 7 months ago #60742 by slabbi
Replied by slabbi on topic Re:Realnames character encoding bug
Maybe I have a better fix for that problem (it's a little bit more complex but should work with Joomla 1.0 and J!1.5):

1. uddeim.php: uddeIMcompleteUserName()

After "$input = trim(...)" add one line with "iconv".
Since special characters are UTF-8 encoded when sent I convert these into the character which is used on your site (and your database).

[code:1]
$input = trim( class_exists('JRequest') ? JRequest::getVar('value') : mosGetParam($_REQUEST, 'value', '') );
$input=iconv('UTF-8',$config->charset,$input);
[/code:1]

2. uddeim.php: uddeIMcompleteUserName()

Convert all special characters into UTF-8. This is required since the client expects UTF-8.

[code:1]
// assign results
foreach ( $results as $item ) {
$temp = $item->displayname;
$temp = iconv($config->charset,'UTF-8',$temp);
$items[] = rawurlencode($temp);
}
[/code:1]

3. include.php: uddeIMdoAutocomplete()

The characters are encoded, so unencode these characters.

[code:1]
choice = decodeURI(choice); // was "choice = unescape(choice);"
[/code:1]

Note, that you have to specify which character set you are using in the system tab. When you are using J!1.5 this should be "UTF-8". In Joomla 1.0 (german) it should be "ISO8859-1".

Post edited by: slabbi, at: 2008/04/10 11:41

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
16 years 7 months ago #60744 by slabbi
Replied by slabbi on topic Re:Realnames character encoding bug
To anybody who is using this fix:

Please report your Jommla version, the character set you have specified, and if it is working...

It would be nice if also admins who have had no problems with uddeIM before could check this fix.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • kruptos
  • kruptos
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
16 years 6 months ago #62367 by kruptos
Replied by kruptos on topic Re:Realnames character encoding bug
Hello :)

I'm using Joomla!1.5.3 in legacy mode, CB1.1, UddeIM 1.1/2008-03-30 and I have problems with displaying Cyrillic names...

When I am at someone's profile and try to send a message to him/her from Messages/Send Private Message, the name in the field "To:" is looking like this: "��боми� �и�илов"
When I choose the name from the drop down box everything is just fine!

I have applyed the fixes to php files you specified, checked the database:
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_unicode_ci

in SYSTEM tab everything is set to both utf8 and still they get the same strange symbols!

Am I missing something?

PLEASE, I'll be very grateful if you can help me with this:)

Thank you in advance!!!

Post edited by: kruptos, at: 2008/05/05 23:47

Please Log in or Create an account to join the conversation.

  • grvulture
  • grvulture
  • OFFLINE
  • Posts: 10
  • Thanks: 0
  • Karma: 18
16 years 6 months ago #62383 by grvulture
Replied by grvulture on topic Re:Realnames character encoding bug
this fix is not working for greek language, on J!1.5.2, CB1.1

my SQL collation is utf8_general_ci

and I know how to solve things with greek language on other plugins... can't figure it out with uddeIM though... there must be some other lines of code to fix that we're missing...

same problems with "kruptos" guy...

it should also be reported as a bug, that no matter if you set all charsets to UTF-8 in BackEnd-uddeIM-Configuration-SYSTEM tab, nothing changes...

by removing the "rawurlencode" in uddeim.php, at least the autocomplete function works ok!

SUPER ACTIVITY PLUGIN:
www.axxis.gr/super_activity/

Please Log in or Create an account to join the conversation.

Moderators: beatnantslabbikrileon
Powered by Kunena Forum