Thursday, August 23, 2012

RSS and HTML Again

OK, there is a Best Practices Profile for RSS 2.0 which says that text in the <description> element must be suitable for presentation as HTML. I can’t help but feel that this is merely a hack to overcome the lacking original RSS specifications.

Saturday, August 18, 2012

RSS and HTML

Imagine entering some text describing HTML tags (like “The <p> tag defines a paragraph”) into an RSS 2.0 feed (the most common feed format). Without any indication of the format of the textual data, should this be interpreted as plain text or HTML? Impossible situation. Atom lets you clearly define the type of the content; “text”, “html” or “xhtml”.

Why Atom isn’t used more is over my head.

Tuesday, August 14, 2012

Saga’s “Heads Or Tales”: Is It Flawed?

This article was originally published as a static entry on my home page, but it probably won’t hurt to let Blogger spread the word as well.

I recently bought the 2003 Steamhammer/SPV remaster (cat. no. SPV 076‐7439A CD) of Saga’s Heads Or Tales album. It exhibits seriously exaggerated treble. It actually sounds like my 1994 Polydor CD (cat. no. 815 410‐2) without de‐emphasis applied to it (one of the very few CDs with pre‐emphasis that I own), only even worse, and with increased loudness. It seems like they’ve been working with pre‐emphasized audio during the remastering without knowing it.

I’ve listened to my 1983 Bon Aire vinyl (cat. no. 208 477), and it sounds awfully similar to the remaster, although not quite as bad. Is it possible that they’ve been using pre‐emphasized audio on the vinyl as well?

I’ve recorded two samples (The Flyer, Social Orphan) from the Bon Aire vinyl, and applied de‐emphasis to them (The Flyer, Social Orphan). The de‐emphasized versions sound very similar to the 1994 Polydor CD (The Flyer, Social Orphan). I don’t have the best turntable in the world here (it’s a 35 year old Luxor with DIN level output), but it will hopefully be enough for this “demonstration”. Proof or not? It’s an interesting discovery nevertheless. I’ve also listened to a Bon Aire CD (cat. no. 258 477) that uses pre‐emphasis just like the Polydor CD. They sound very similar. If the treble‐exaggerated sound on the vinyl was intentional, why wouldn’t they be consequent and make the CD sound the same? Perhaps the Polydor vinyl is OK in this regard, I haven’t had the opportunity to listen to it.

To make things clear, I should perhaps add that Saga is, and has always been, one of my all‐time favorite bands. If they weren’t, I wouldn’t put my energy into this in the way that I’ve been doing.

XHTML in Atom with XML::Simple

Unescaped XHTML in an Atom feed needs to be wrapped inside a CDATA section before parsing with Perl’s XML::Simple module. Otherwise it will be treated as XML data belonging to the feed. According to RFC 4287, the enclosing <div> element must not be considered part of the content, so that one will not be included in the CDATA section. An example:

<content type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
    <p>This is some content.</p>
  ]]></div>
</content>

Below is an example of how to wrap the contents of the <content> element (excluding the enclosing <div> element) inside a CDATA section programmatically, assuming that the unprocessed Atom XML data is in $doc:

$doc =~ s/(<content\s.*?type=["']xhtml["'].*?>\s*<div\s.*?>)
        (.*?)(<\/div>\s*<\/content>)/$1<![CDATA[$2]]>$3/gsxo;

Monday, August 13, 2012

Atom 1.0 for Changelogs

I’m now using Atom 1.0 for the changelogs at my home page. It is definitely the most robust feed format to date, albeit more complex to process than other formats.