Freetag - 8bit-tags list in entry-editor

Creating and modifying plugins.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by garvinhicking »

Hi!

That's too strange. Did you make sure you overwrote the file? When you initially used spartacus to download a plugin and upload via FTP, in some cases the permissions will not allow you to overwrite.

The the serendipity_event_freetag.php if it contains any "mb_internal_encoding" function calls...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by LazyBadger »

ls -la

Code: Select all

...
-rw-r--r--   1 user317975 user317975    85858 Jun 17 23:04 serendipity_event_freetag.php
...
grep -i mb_internal_encoding serendipity_event_freetag.php

Code: Select all

File serendipity_event_freetag.php:
                    if (function_exists('mb_internal_encoding')) {
                        mb_internal_encoding(LANG_CHARSET);
                    if (function_exists('mb_internal_encoding')) {
                        mb_internal_encoding(LANG_CHARSET);
                            if (function_exists('mb_internal_encoding')) {
                                mb_internal_encoding(LANG_CHARSET);
maybe adding additional parameter to the mb_ function will be bullet-proof?
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by garvinhicking »

Hi!

You are using the UTF-8 russian language file, right? "LANG_CHARSET" should contain "UTF-8". But yes if you could try to add LANG_CHARSET to the mb_strtolower-cals, taht would be great.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by LazyBadger »

I see none direct mb_strtolower calls and only one place (mb-wrapper) in include/lang.inc.php, serendipity_mb()
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by garvinhicking »

Hi!

there are several direct calls to mb_strtolower: In line 801, 822, 864 and 981.

Regards,
Garvi
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by LazyBadger »

Found, edited - no changes once more time...
Quis custodiet ipsos custodes?
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by LazyBadger »

Found one more point, fixed and verified

Code: Select all

--- Z:\serendipity_event_freetag-old.php 25.06.2010  9:18:32
+++ Z:\serendipity_event_freetag.php 25.06.2010  10:15:24
@@ -934,943 +934,943 @@
 <?php
                             $lastletter = '';
                             foreach ($taglist as $tag => $count) {
-                                if (strtoupper(substr($tag, 0, 1)) != $lastletter)
+                                if (mb_strtoupper(mb_substr($tag, 0, 1)) != $lastletter)
-                                    echo " <b>|".strtoupper(substr($tag, 0, 1)).':</b> ';
+                                    echo " <b>|".mb_strtoupper(mb_substr($tag, 0, 1)).':</b> ';
                                 echo "<a href=\"#tagListAnchor\" style=\"text-decoration: none\" onClick=\"addTag('$tag')\">$tag</a>, ";
-                                $lastletter = strtoupper(substr($tag, 0, 1));
+                                $lastletter = mb_strtoupper(mb_substr($tag, 0, 1));
                             }
 ?>
                         </div>
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by garvinhicking »

Hi!

Great find! I'm sorry, I completely missed that one - I was fixated on strtoLOWER. Now also fixed in CVS!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Freetag - 8bit-tags list in entry-editor

Post by LazyBadger »

And small addons (improvements, no bugs here) for better representing tags (multibyte and not)
1 - sort() or natsort() of $taglist before output in foreach
2. Adding as second choice for case-processing ucfirst() (mb_ version)

Code: Select all

<?php

if (!function_exists('mb_ucfirst') && function_exists('mb_substr')) {
    function mb_ucfirst($string) {
        $string = mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1);
        return $string;
    }
}

?>
Because now I
- get "not so natural" order of russian letters in tags-selector
- tags with same first letter of word, but different case are separated into different section

It's not a problem, but not perfect view only (and only in backend)
Quis custodiet ipsos custodes?
Post Reply