Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
Who's Online
4 registered (GEN™, packlite, Thelockman, 1 invisible), 36 Guests and 20 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 02/15/08
Posts: 18
Top Posters (30 Days)
Ruben Rocha 95
Rick 85
Mark S 74
Gizmo 49
Thelockman 49
driv 35
Sirdude 32
ntdoc 28
packlite 27
AllenAyres 25
Latest Photos
bear test
Beach Barbie-Q
Sunset
Accept the challenge!
Trees
Topic Options
Rate This Topic
#217776 - 10/10/08 02:20 PM [FIXED in 7.4] [7.3.1] Split characters not successful for multibyte characters
smallufo Offline
enthusiast

Registered: 06/05/06
Posts: 205
Loc: Taiwan
After 7.3(.1) , it seems UBBT will split characters in the left/right column , such as Shout Box , Post Islands ...
Such function works correctly in English forum (because each English character is one byte ) ,
but in multibyte forum , it cannot correctly judge the character's boundary , sometimes (in fact , very often) the character is splitted , making it hard to read.

In my forum's shout box , users can only type 12 bytes in Chinese , that is , 6 characters in Chinese , any longer characters are dropped . This annoys my users , they have to insert a lot of space in their sentence , making each "token" not longer than 6 (Chinese) characters. It looks very like stutter

How to disable it ? or fix it ?
_________________________

English is not my native language.
I try my best to express my thought precisely.
I hope you understand what I mean.
If any misunderstanding results from culture gaps , I apologize first.

Top
#217778 - 10/10/08 02:33 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: smallufo]
smallufo Offline
enthusiast

Registered: 06/05/06
Posts: 205
Loc: Taiwan
I trace the code , find it is shoutit.inc.php that handles the split :

Code:
foreach ($words as $i =>$w) {
        if (strlen($words[$i]) > 20) {
                $words[$i] = wordwrap($words[$i], 20, "<br />", 1);
        }
}


I try to comment out these codes , it worked . My users can speak as they wish .
But I still hope future version can solve this problem.

_________________________

English is not my native language.
I try my best to express my thought precisely.
I hope you understand what I mean.
If any misunderstanding results from culture gaps , I apologize first.

Top
#217784 - 10/10/08 04:01 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: smallufo]
smallufo Offline
enthusiast

Registered: 06/05/06
Posts: 205
Loc: Taiwan
To fix post_island , edit cache_builders/post_island.php
comment out these codes :
Code:
foreach ($words as $i => $w) {
        if ( strlen ( $words[$i] ) > 20 ) {
                $words[$i] = wordwrap( $words[$i], 20, "<br />", 1);
        } // end if
} // end foreach


It works.

I think PHP shouldn't rely on strlen to judge the 'width' of a character. Because strlen seems calculate the memory consumption of a word , not the word's display width.

For English , each character consumes one byte , and it is one byte width , too.
BUT ,
For Chinese UTF-8 encoded character , each character consumes 3 bytes , but it is only 2-byte width (in fixed-width fonts).
So , my users can only type 6 Chinese character each token , they are 18 bytes , but only occupy 12 bytes width.

I am not familiar with PHP , don't know how to get a word's display width.

Maybe there should be a 'wrap text toggle' for each widget (Shout Box and Post Island ...)

_________________________

English is not my native language.
I try my best to express my thought precisely.
I hope you understand what I mean.
If any misunderstanding results from culture gaps , I apologize first.

Top
#217790 - 10/10/08 04:59 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: smallufo]
Rick Administrator Offline

*****

Registered: 06/04/06
Posts: 7998
Loc: Aberdeen, WA
Have this fixed in 7.4. When language is set to UTF-8 the wordwrap function is used after utf8_decoding the string, so it splits and the proper location and then utf8_encodes the remaining string.
_________________________
UBB.threads™ Developer
My Personal Website · StogieSmokers.com

Top
#217791 - 10/10/08 05:00 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: Rick]
Rick Administrator Offline

*****

Registered: 06/04/06
Posts: 7998
Loc: Aberdeen, WA
I should say the shoutbox was fixed. I needed to apply the same code to the post island cache_builder which I just did for the final release.
_________________________
UBB.threads™ Developer
My Personal Website · StogieSmokers.com

Top


Shout Box

Today's Birthdays
theregit
Recent Topics
7.4.2 UNREAD
by Thelockman
57 minutes 41 seconds ago
7.4.1 show/hide category bug
by Seattlebrian
Today at 11:56 AM
7.4.2 Discussion
by Rick
Today at 10:21 AM
UBBCentral now running 7.4.2
by Rick
Today at 10:21 AM
New members don't get access and are not displayed in the config panel
by Yomar
Yesterday at 03:32 AM
Forum Stats
4298 Members
33 Forums
30693 Topics
156040 Posts

Max Online: 978 @ 06/24/07 08:19 PM