[wp-trac] Re: [WordPress Trac] #8446: post_class() outputs invalid
css class
WordPress Trac
wp-trac at lists.automattic.com
Sun Apr 5 01:51:16 GMT 2009
#8446: post_class() outputs invalid css class
--------------------------+-------------------------------------------------
Reporter: lilyfan | Owner: anonymous
Type: defect (bug) | Status: new
Priority: high | Milestone: 2.7.2
Component: Template | Version: 2.7
Severity: major | Keywords: class needs-patch
--------------------------+-------------------------------------------------
Comment(by hakre):
i'd like to see both in: ids and slugs.
i doubt that category-\%e6\%90\%ba\%e5\%b8\%af is a valid class name in or
at least it is as valid as category-%e6%90%ba%e5%b8%af, because % must be
escaped with their UNICODE hex representation that would be escaped with
\\ then but (oh my gosh), must be followed by a space, tab linebreak and
the such. this does all not sound practicable to me, because it will
actually break the class identifier then.
anyway, the suggested is misleading. for classnames, unicode letters can
be used. that is no problem. it looks like the $cat->slug contains an url-
encoded slug that is not valid UTF-8 any longer (as in the meaning of a
classname).
since the slug comes out of the database, the problem already resides in
the database, that is a local install.
for current bleeding, i see no escape routines in any way. so i see no
need for a patch. what must be patched then is the routine, that stores
the slug in the database, that is the category editor in the ACP. but this
will be a larger patchset, because it means that slugs can be stored in
unicode more generously and (potentially) must be properly url-encoded
later on. who knows on how many places (!).
in this case it looks like the user did enter a specific slug, to get a
nice URL. therefore, a plugin that hooks into ''post_class'' could do the
job. since this is not unicode (as far as I assume, i do not write
japanese), i have not idea on how actually to encode the string back to a
readable representation. but it can be done with that hook.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/8446#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list