Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
Who's Online
2 registered (WriteOn, 1 invisible), 21 Guests and 18 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 01/08/07
Posts: 48
Top Posters (30 Days)
Ruben Rocha 179
Gizmo 112
Rick 109
Thelockman 80
driv 43
AllenAyres 35
ntdoc 28
Ian 24
Sirdude 23
ScriptKeeper 20
Latest Photos
My Home System
test photo gallery
Bernese Mountain Dogs
My Daimler
Dorado and shark
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: 203
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: 203
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: 203
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: 7898
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: 7898
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
No Birthdays
Recent Topics
Shrinking graemlins
by Djuma
Yesterday at 05:48 PM
2 problems I'm seeing now.
by DougMM
Yesterday at 04:39 PM
Which CSS Style Controls the bottom lines
by David DelMonte
Yesterday at 01:51 PM
UBBThreads vs. vBulletin -- Defections & Why So Tough to Compare?
by WebMagic
Yesterday at 12:28 PM
Font and column shifts occuring
by Bill B
11/30/08 06:21 PM
Forum Stats
4261 Members
33 Forums
30532 Topics
154962 Posts

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