Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
noWidow fails to process titles ending in a quote
A title post title ending in a quote like this lorem "ipsum" gets its quotes escaped into HTML numeric entities before being passed into noWidow in both title() and recent_articles(), resulting in lorem "ipsum" and thus failing the RegExp [ ]+(\w+[[:punct:]]?)$ test.
Offline
Re: noWidow fails to process titles ending in a quote
I choose to post this here, because it seems to be a similar bug.
I have set “Prevent widowed words in article titles” to “yes”, but the /© wasn’t being added between the last two words in the article titles in some cases.
After some testing, it seems that the no-widow feature doesn’t work when the last word has a special character like, for example, a tilde (á é í ó ú), or an exclamation (!).
Offline
#3 2007-03-19 21:11:53
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: noWidow fails to process titles ending in a quote
It would be helpful if you provided specific examples, Julián. :)
Offline
Re: noWidow fails to process titles ending in a quote
Hi Mary,
sorry, I forgot that.
Titles like:
- Mi nombre es Julián
- ¡A toda máquina!
Last edited by maniqui (2007-03-19 21:59:39)
Offline
#5 2007-03-21 22:25:00
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: noWidow fails to process titles ending in a quote
m,
The regexp used by the noWidow function is affected by the locale. If you’ve set your language to one that includes those characters, and your system has proper locale support, noWidow should work correctly with those strings.
You can check your current locale on the txp diagnostics page. If it’s “C”, or something unrelated to your language, then your system doesn’t have good locale support. (This will affect Textile also).
Last edited by zem (2007-03-21 22:25:24)
Alex
Offline
Re: noWidow fails to process titles ending in a quote
Hi Zem,
I must admit that your post is beyond my comprehension.
This are some chunks I have copy-pasted from my diagnostics.
Please, could you tell me if you see something wrong?
Versión de PHP: 4.4.2
Register globals: 1
Tiempo Local del Servidor: 2007-03-21 23:27:14
MySQL: 4.1.21-standard
Local: es_ES.UTF-8
Servidor:
PHP Server API: cgi
Cabeceras RFC 2616:
Sistema Operativo del servidor: Linux 2.6.9-42.0.2.ELsmp
Plugins Activos: zem_contact_reborn-4.0.3.19, zem_contact_lang-4.0.3.6m, poe_bbclone-0.4m, mem_random_comment-0.2, rss_admin_db_manager-4.3, upm_insert_tab-0.3, anc_hide-1.0, upm_image-0.5.10, upm_img_popper-1.3.3, upm_file-0.2.2, asy_xpwizard-1.0, glx_admin_image-2006.1, zem_nth-0.1, mem_glinklist-0.8.5, ied_doArticle-0.2.1, bas_emff-0.3m, kml_flashembed-1.3.1, cbs_navigation_menu-0.4, wet_for_each_image-0.4, upm_file_popper-0.1, rvm_plugin_diff-0.2, gbp_permanent_links-0.11.566, gbp_admin_library-0.4.581, asy_sitemap-0.7m, Postmaster_library-0.1, Postmaster-0.3
Comprobación previa:
------------------------
El modo de URL limpia sólo para Apache
Algunos archivos de Textpattern han sido modificados: /publish/taghandlers.php
Las siguientes funciones de PHP (que pueden ser necesarias para Textpattern) están deshabilitadas en tu servidor: dl,passthru,proc_open,proc_close,shell_exec,system,exec
Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: utf8
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
18 Tables: OK
Extensiones de PHP: zip, xmlrpc/0.51, xml, wddx, tokenizer/0.1, standard/4.4.2, sockets, session, pspell, posix, pgsql, overload, mysql, mhash, mcrypt, mbstring, imap, gettext, gd, ftp, exif/1.4 $Id: exif.c,v 1.118.2.37.2.4 2006/01/01 13:46:52 sniper Exp $, domxml/20020815, curl, ctype, calendar, bcmath, zlib/1.1, pcre, openssl, Zend Optimizer
pretext_data: array (
'id' => '',
's' => '',
'c' => '',
'q' => '',
'pg' => '',
'p' => '',
'month' => '',
'author' => '',
'request_uri' => '/1ca2a04c1db28957e1978f4a1c769ee7/?txpcleantest=1',
'qs' => 'txpcleantest=1',
'subpath' => '\\/',
'req' => '/1ca2a04c1db28957e1978f4a1c769ee7/?txpcleantest=1',
)
Thanks.
Last edited by maniqui (2007-03-22 02:37:33)
Offline
#7 2007-03-22 21:09:45
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: noWidow fails to process titles ending in a quote
Please, could you tell me if you see something wrong?
No. Textpattern relies on your server’s ability to recognize letters. In this case, for whatever reason, your server can’t do that correctly.
Alex
Offline
#8 2007-03-22 21:28:58
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: noWidow fails to process titles ending in a quote
Give r2255 a try.
If that change is going to stay in, I need some users with PHP 4.3 (particularly 4.3.4 or earlier) and PHP 5.0 to test it.
Alex
Offline
Re: noWidow fails to process titles ending in a quote
I haven’t learned how to work with subversions yet. :(
I hope to learn that soon.
Thanks anyway for looking at this issue. Hope it is fixed.
Last edited by maniqui (2007-03-23 04:02:35)
Offline
Re: noWidow fails to process titles ending in a quote
zem wrote:
I need some users with PHP 4.3 (particularly 4.3.4 or earlier) and PHP 5.0 to test it.
Test cases:
echo setlocale(LC_ALL,'0');
dmp(noWidow('Mi nombre es Julián'));
dmp(noWidow('Mi nombre es Julian'));
dmp(noWidow('lorem "ipsum"'));
dmp(noWidow('lorem ipsum'));
dmp(noWidow('hätti wäri'));
dmp(noWidow('hätti wari'));
dmp(noWidow('ninet wäri'));
Results for PHP 4.3.11
de_DE
Mi nombre es Julián
Mi nombre es& #160;Julian
lorem& #160;"ipsum"
lorem& #160;ipsum
hätti wäri
hätti& #160;wari
ninet wäri
Results for PHP 5.2.1
de_DE.UTF-8
Mi nombre es& #160;Julián
Mi nombre es& #160;Julian
lorem& #160;"ipsum"
lorem& #160;ipsum
hätti wäri
hätti& #160;wari
ninet& #160;wäri
“ä” (a-Umlaut) is a letter in the de_DE locale. & #160 occurs without an intermediate space in the original output, of course.
Offline
#11 2007-05-09 01:38:42
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: noWidow fails to process titles ending in a quote
Wet: brilliant, thanks.
Can anyone with PHP 4.3.4 or earlier confirm that noWidow runs without causing a PHP error or warning?
Alex
Offline