Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
7 registered (SteveS, mcasado, Mike L, Gizmo, SD, Bjab, driv), 18 Guests and 14 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 06/05/06
Posts: 255
Top Posters (30 Days)
Ruben 63
SD 54
Gizmo 48
gliderdad 33
Dunny 21
driv 18
dbremer 16
Iann128 16
Stan 14
Mark S 13
Latest Photos
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Gizzo Marx
Topic Options
#217776 - 10/10/08 05:20 PM [FIXED in 7.4] [7.3.1] Split characters not successful for multibyte characters
smallufo Offline
enthusiast
Registered: 06/05/06
Posts: 263
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
Express Hosting
Express Hosting "We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
#217778 - 10/10/08 05:33 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: smallufo]
smallufo Offline
enthusiast
Registered: 06/05/06
Posts: 263
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 07:01 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: smallufo]
smallufo Offline
enthusiast
Registered: 06/05/06
Posts: 263
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 07:59 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: smallufo]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
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.
Top
#217791 - 10/10/08 08:00 PM Re: [7.3.1] Split characters not successful for multibyte characters [Re: Rick]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
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.
Top



Moderator:  AllenAyres, Harold, Ian, Ron M 
Shout Box

Today's Birthdays
No Birthdays
Recent Topics
Edit Post
by Bert
01:19 PM
A positive note
by SteveS
09:36 PM
How to locate links to particular site if they are only used in images?
by Conrad
02/10/12 09:41 PM
Pictures not displaying
by Marker23
02/09/12 10:04 PM
Issue with logging out constantly
by Flanuva
02/09/12 07:05 PM
Forum Stats
10213 Members
36 Forums
33667 Topics
180917 Posts

Max Online: 978 @ 06/24/07 11:19 PM
Random Image