comparison msitegen.inc.php @ 569:9e8637631089

Fix stStrChop() and stStrChopPad() UTF-8 handling.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 16 May 2014 19:12:10 +0300
parents ed2247111fdd
children ce11ea112a65
comparison
equal deleted inserted replaced
568:4024f663a8e7 569:9e8637631089
642 } 642 }
643 643
644 644
645 function stStrChop($str, $len) 645 function stStrChop($str, $len)
646 { 646 {
647 return (strlen($str) > $len) ? substr($str, 0, $len - 3)."..." : $str; 647 return (mb_strlen($str) > $len) ? mb_substr($str, 0, $len - 3)."..." : $str;
648 } 648 }
649 649
650 650
651 function stStrChopPad($str, $len) 651 function stStrChopPad($str, $len)
652 { 652 {
653 return sprintf("%-".$len."s", stStrChop($str, $len)); 653 $tmp = stStrChop($str, $len);
654 for ($i = mb_strlen($tmp); $i < $len; $i++)
655 $tmp .= " ";
656 return $tmp;
654 } 657 }
655 658
656 659
657 660
658 function cmPrintCSSLine($uri, $media = "") 661 function cmPrintCSSLine($uri, $media = "")
790 // 793 //
791 if (!isset($localeInited) || !$localeInited) 794 if (!isset($localeInited) || !$localeInited)
792 { 795 {
793 $localeInited = TRUE; 796 $localeInited = TRUE;
794 797
795 if (!isset($pageCharset)) 798 $pageCharset = "UTF-8";
796 $pageCharset = "UTF-8";
797
798 mb_internal_encoding($pageCharset); 799 mb_internal_encoding($pageCharset);
799 800
800 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset)); 801 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
801 setlocale(LC_ALL, $tmp); 802 setlocale(LC_ALL, $tmp);
802 } 803 }