Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2006
Posts: 215
enthusiast
enthusiast
Joined: Jun 2006
Posts: 215
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.
Joined: Jun 2006
Posts: 215
enthusiast
enthusiast
Joined: Jun 2006
Posts: 215
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.
Joined: Jun 2006
Posts: 215
enthusiast
enthusiast
Joined: Jun 2006
Posts: 215
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.
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
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.

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
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.


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
After server reboot
by Morgan - 09/02/2026 8:27 AM
Email Settings
by Outdoorking - 05/13/2026 2:44 AM
Who's Online Now
0 members (), 171 guests, and 128 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)