Page 2 of 2

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

Posted: Sat Jun 19, 2010 4:06 pm
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

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

Posted: Sat Jun 19, 2010 9:41 pm
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?

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

Posted: Sun Jun 20, 2010 1:34 pm
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

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

Posted: Sun Jun 20, 2010 5:00 pm
by LazyBadger
I see none direct mb_strtolower calls and only one place (mb-wrapper) in include/lang.inc.php, serendipity_mb()

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

Posted: Mon Jun 21, 2010 3:07 pm
by garvinhicking
Hi!

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

Regards,
Garvi

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

Posted: Mon Jun 21, 2010 9:43 pm
by LazyBadger
Found, edited - no changes once more time...

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

Posted: Fri Jun 25, 2010 6:32 am
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>

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

Posted: Fri Jun 25, 2010 9:00 am
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

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

Posted: Fri Jun 25, 2010 10:18 am
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)