Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
3 registered (id242, SD, gliderdad), 30 Guests and 15 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 01/24/07
Posts: 171
Top Posters (30 Days)
Ruben 51
Gizmo 24
DennyP 24
Dunny 15
SteveS 14
AllenAyres 12
SD 10
dbremer 10
drkknght00 9
doug 8
Latest Photos
OK Corral Shoot Out
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Topic Options
#217776 - 10/10/08 05:20 PM [FIXED in 7.4] [7.3.1] Split characters not successful for multibyte characters
smallufo Online   content
enthusiast
Registered: 06/05/06
Posts: 265
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 Online   content
enthusiast
Registered: 06/05/06
Posts: 265
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 Online   content
enthusiast
Registered: 06/05/06
Posts: 265
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
Temporary Password email not being received
by
05/24/12 10:02 PM
Ability to "like" individual posts (not Facebook "likes)
by doug
05/23/12 09:03 AM
Island Permissions
by ThreadsUser
05/22/12 03:03 PM
streaming video
by prkrgrp
05/20/12 07:02 PM
New Posts Corrupted? Can someone help?
by PianoWorld
05/19/12 09:41 AM
Forum Stats
10492 Members
36 Forums
33842 Topics
181709 Posts

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