Link text to open message not always visible

16 years 1 month ago #59394 by boyjahq
I am using uddeIM 1.0/2007-02-01 and CB 1.1 and am having trouble with UTF-8 and Japanese language. It seems that in some (but not all) cases, if a message starts with Japanese characters, then that message will have NO message text link in the receipient's inbox, which means that there is nothing for them to click to open and read the message.

It does not happen if I use alphabet, only Japanese. And as you can see in the screen shot, it does not happen every time with Japanese (because there are Japanese message line links on some posts). But EVERY case where the message link line is blank, there was Japanese text in the beginning of the message.

Any advice on how to solve this problem would be most appreciated!



Post edited by: boyjahq, at: 2008/03/21 05:16
Attachments:

Please Log in to join the conversation.

16 years 1 month ago #59408 by slabbi
Well, could you check the "Used charset" setting in the backend (-> System tab), plz? Try UTF-8 here.

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

Please Log in to join the conversation.

16 years 1 month ago #59427 by boyjahq
slabbi wrote:

Well, could you check the "Used charset" setting in the backend (-> System tab), plz? Try UTF-8 here.


Thanks for your reply. I have from the beginning had all character set settings on UTF-8.

One thing I discovered is that if I increase the number of characters for the "First characters list" setting, then more of these "teaser" message links appear (some of the blank ones suddenly have text in them). The higher I set this number, the more of the links become visible. In fact, it seems that if I set the number to be higher than the number of characters in the longest message, then they all show up. However, the inbox list is then a shambles with all messages showing up in their entirety as the teaser link.

So to summarize: it seems that if a message in Japanese is longer than the "First characters list" setting, then the teaser text that you click to read the message does not show up. In the screen shot from my first posting, those messages in Japanese that DID show teaser links to the original message just happened to be very short messages. Those that were blank and had no link were much longer messages in Japanese.

Does that help to understand where the problem may be?

Post edited by: boyjahq, at: 2008/03/21 16:54

Please Log in to join the conversation.

16 years 1 month ago #59437 by slabbi
It seems that there are some problems with UTF-8 characters and substr().

You you try following please:

1. Add following to includes.php:

[code:1]function uddeIM_utf8_substr($str,$start)
{
preg_match_all("/./u", $str, $ar);

if(func_num_args() >= 3) {
$end = func_get_arg(2);
return join("",array_slice($ar[0],$start,$end));
} else {
return join("",array_slice($ar[0],$start));
}
}

function uddeIM_utf8_strlen($str)
{
$i = 0;
$count = 0;
$len = strlen ($str);
while ($i < $len)
{
$chr = ord ($str[$i]);
$count++;
$i++;
if ($i >= $len)
break;

if ($chr & 0x80)
{
$chr <<= 1;
while ($chr & 0x80)
{
$i++;
$chr <<= 1;
}
}
}
return $count;
}

[/code:1]

2. Then replace in includes.php in function uddeIMteaser() "substr" with "uddeIM_utf8_substr" and "strlen" with "uddeIM_utf8_strlen".

Does it work better now?

Post edited by: slabbi, at: 2008/03/21 18:30

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

Please Log in to join the conversation.

16 years 1 month ago #59464 by boyjahq
Well, that little piece of code solved the problem. You are a genius! Thank you SO MUCH!
:)

Please Log in to join the conversation.

16 years 1 month ago #59467 by slabbi
Sometimes, not all the time ;)

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

Please Log in to join the conversation.

Moderators: beatnantslabbikrileon
Time to create page: 0.220 seconds

Facebook Twitter LinkedIn