Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Sunday, May 19 2013 @ 01:22 AM EDT


 Forum Index > General Discussions > Feedback New Topic Post Reply
 Issue of the multibyte char sets
   
vvprok
 02/27/06 04:54AM (Read 1878 times)  
+----
Newbie

Status: offline


Registered: 07/07/03
Posts: 10
Geeklog is translated to many languages. It is fine!
However Gl does not work with multibyte characters correctly.

As you know, string related functions strlen, strpos, substr, etc. do not take into account string encoding and works with byte sequence only. In such way, f.e. links plugin incorrecly composes brief string for "whats new" block. It leaves 16 bytes of the link title and then adds "...". As result for uk_UA.UTF-8 locale I got 7 symbols of the title in Ukrainian language and then some garbage symbols before "...".

And as you also know, there are another set of functions especially for multibyte encoding: mb_strlen, mb_strpos, mb_substr, mb_etc.

I already fixed links plugin with mb_* functions (see here).
I simply changed calls
PHP Formatted Code
str...(...)

 
to the
PHP Formatted Code
mb_str...(..., $LANG_CHARSET)

 
However, it looks quite complicated to be used as total solution for all string related operations.

So, I propose to create lib-strings.php module. It will contain string-related functions. Those functions will hide from Gl code implementation details of the string related code. All of them will look in the next manner:
PHP Formatted Code

function gl_strlen($string)
{
    global $LANG_CHARSET;
    return mb_strlen($string, $LANG_CHARSET);
}


 


So, what do you think?

 
Profile Email Website
 Quote
sakata
 03/16/06 12:29PM  
++---
Junior

Status: offline


Registered: 12/17/01
Posts: 25
Hi,
I have created COM_titlesplit function.
see
http://www.geeklog.net/forum/viewtopic.php?showtopic=65070

I think having lib-strings.php is a good idea.


 
Profile Email Website
 Quote
Content generated in: 0.74 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content