You are not logged in.
Pages: 1
Hi,
I just tried out textpattern 4.0.1 and found two cosmetic glitches concerning Japanese characters.
1)
In txp_prefs.php there are two places where
echo tr(tdcs(hed(ucfirst(gTxt($a[‘event’])),1),3));
appear in code.
This ucfirst() garbles Japanese characters since there is no such thing as “upper case” letters in the language.
Fix:
Just change the two occurences to
echo tr(tdcs(hed(gTxt($a[‘event’]),1),3));
and the characters render fine.
2)
In txp_category.php, to canonicalize(?) the category names,
$name = preg_replace(”/[^[:alnum:]\-_]/”, “”, str_replace(” “,”-”,$name));
appear.
This does not work with Japanese characters.
I suspect the [:alnum:] part in regex.
Fix:
Just make categories with dummy alphabet names and then change their titles in database using tools such as phpMyAdmin.
Last edited by polkazebra (2005-10-03 06:10:15)
Offline
This ucfirst() garbles Japanese characters since there is no such thing as “upper case” letters in the language.
It shouldn’t do any harm if the locale setting is correct (at least that’s what the manual says).
What’s your locale? (admin > diagnostics)
Alex
tstate
Offline
Thank you for your quick response.
Texpattern diagnostic_info tab says as follows :
php_version: 5.0.5
magic_quotes: 1/0
MySQL: 4.1.14-log
locale: ja_JP.UTF-8
server: Apache/2.0.54 (Unix) DAV/2 mod_fastcgi/2.4.2 PHP/5.0.5
apache_version: Apache/2.0.54 (Unix) DAV/2 mod_fastcgi/2.4.2 PHP/5.0.5
So my locale is ja_JP.UTF-8.
Offline
I think I found a solution for the ucfirst problem :
Change
echo tr(tdcs(hed(ucfirst(gTxt($a[‘event’])),1),3));
to
echo tr(tdcs(hed(mb_convert_case(gTxt($a[‘event’]),MB_CASE_TITLE),1),3));
.
Description of mb_convert_case is found at
http://www.php.net/manual/en/function.mb-convert-case.php
.
This function requires PHP 4.3 and above but works perfectly, i.e.,
when I set my language to English the items appear properly capitalized,
when I set it to Japanese the first letter renders without being messed up.
Last edited by polkazebra (2005-10-04 02:50:46)
Offline
> “Just make categories with dummy alphabet names and then change their titles in database using tools such as phpMyAdmin.”
Textpattern already does this for you. Enter the dummy name, then once the category is created, click on that category’s link. It will take you to a page where you can re-define the name and title.
My email address has changed recently. If you need to contact me, use the forum contact form.
Offline
Pages: 1