Plugin can't handle non-ASCI characters and other bugs (incl. suggestions for solutions)

Despite having the configuration file saved as UTF-8 (double-checked in two editors) the select drop downs showed ? where scandinavian characters like åäö should be we solved this by wrapping mb_convert_encoding($blog_type, ‘UTF-8’:wink: and mb_convert_encoding($blog_subtype, ‘UTF-8’:wink: where the options are echoed.

Other bugs:

$selected = ' selected="selected"';

Should be:

$selected = ' selected';

Because it is a boolean value and the selected=”selected” is not HTML or XHTML.

We also would like the style=”” attributes moved into a CSS files, the size os just humongous and it can’t be overridden like it is right now. We have solved this by simply deleting the attributes right away from the code the blog-types.php file and now it looks just fine!

The file also contains some code like this, which is invalid HTML:

<script language='javascript'>

But should instead be:

<script type="text/javascript">

On a two places the select elements use id=”blog_types[]” and on two places id=”blog_subtypes[]”, this is not valid HTML, the characters [ and ] are not allowed in the id attribute. They are only necessary in the name attribute anyway.

  • Philip John
    • DEV MAN’s Apprentice

    Hiya!

    Thanks for this. I’m not sure about selected=”selected” as I’m pretty confident that is valid XHTML. Blank attributes (ie just “selected”:wink: are no longer valid.

    I’m pretty sure the [] characters are required for the plugin to function too.

    However, I’ll leave both of those with the developer….

    Phil

  • Niklas
    • The Incredible Code Injector

    It is the other way around, they are boolean attributes as defined by both specifications:

    HTML 4.01: http://www.w3.org/TR/html4/interact/forms.html#adef-selected

    HTML 5: http://dev.w3.org/html5/spec/Overview.html#the-select-element

    Starting with WordPress 3.3 the admin section is going to use the HTML5 doctype, so this is just future-proofing. I also know that you seem to care very much about bandwidth for your users so using the correct boolean attributes (like selected, disabled, checked…) could save some of that for you!

  • Niklas
    • The Incredible Code Injector

    Yeah, it didn’t invalidate the HTML 4.01 markup, but later this year WordPress 3.3 will use HTML5 doctype and that means you have to abide to the standard.

    If you do not, then can I at least ask for consistency so that you use the same syntax everywhere (so we can run a simple search and replace script upon update) rather than a mix of the two styles?

    Can I refer to your hacker sense of saving memory for the user? Shorter strings means less memory used for unnecessary strings and less bandwidth required to send the data to the client.

    Can I ask for it and refer to readability?

    <select required="required" multiple="multiple" disabled="disabled" autofocus="autofocus">
    <option selected="selected"…

    Compared to

    <select required multiple disabled autofocus>
    <option selected…

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.