On Fri, Mar 15, 2013 at 8:52 PM, Todd Herman <[email protected]> wrote:
> I am not overly familiar with the data URI format but when I looked it
> up it says the format requires you to specify the encoding. The example in
> section 11.3 of the XEP does not do this. It has the following:
>
> **
>
> ** **
>
> <uri>data:image/jpeg;{data}</uri>****
>
> ** **
>
> Where “{data} is the base 64 encoded image. My research shows that the
> data URI should look more like this:****
>
> ** **
>
> data:image/jpeg;base64,{data}****
>
> ** **
>
> Can someone let me know which is correct? I thought maybe it would just
> default to base 64 if omitted but the article I read said it defaults to
> something else entirely. ****
>
>
>
RFC 2397 has the ABNF:
dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype := [ type "/" subtype ] *( ";" parameter )
data := *urlchar
parameter := attribute "=" value
So the ";base64" is optional, as is the media type. However, the example is
wrong, since there's always a comma before the data, and the semicolon only
precedes the "base64" string.
Dave.