Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kalle 8 posts 37 karma points
    Jun 29, 2010 @ 16:25
    Kalle
    0

    Ampersand gives me an EntityName error

    After installing the new ImageGen version (2.2.1.38932) I get the following error message when there is an URL encoded ampersand (%26) in the query:
    An error occurred while parsing EntityName. Line 1, position 14.

    The original URL is:
    http://localhost/umbraco/ImageGen.ashx?Text=MEDIA+%26+PRESS

    All other special characters seems to be working fine.

    Did I do anything wrong here?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jun 30, 2010 @ 04:05
    Douglas Robar
    2

    Hi, Kalle,

    ImageGen 2.2 includes some changes to the way text is rendered, giving it more capabilities than before. One of the side-effects of these improvements is the need to url-encode the html-encoded text.

    This is easier to explain with an example...

    Let's say you want ImageGen to return an image with 'MEDIA & PRESS', so first you html-encode your string, which gives you:

    ?text=MEDIA & PRESS

    And then you need to url-encode that string, which gives you:

    ?text=MEDIA+%26amp;+PRESS

    Which will create the string output you're looking for.

     

    The umbraco.library contains built-in functions for both html-encoding and url-encoding to automate this if you need it.

    cheers,
    doug.

  • Kalle 8 posts 37 karma points
    Jun 30, 2010 @ 08:56
    Kalle
    0

    Works like a charm. Thank you!

Please Sign in or register to post replies

Write your reply to:

Draft