1. Create a plain text CCK field on any content type.
2. Using mail_edit and subscriptions_cck, include this CCK field in the body of a subscription message.
3. Edit a node so that its instance of this field contains quotation marks. Example: This is my "quoted" test content
4. Save the node with the send subscription option checked.
Result: The message body will have special characters formatted as HTML entities (even though the message is plain text).
It looks like subscriptions_cck_subscriptions_get_mailvars()'s use of content_format() may be the issue here. This function is assuming that plain text output must be formatted for display on an HTML page?
I'm happy to write a patch for this, but am not sure what the preferred approach for fixing it would be (I'm not that familiar w/ CCK or Subscriptions source code). A simple workaround type fix may be to create an extra set of template variables that provide the "raw" field values. This seems like it should allow plain text fields to work, but gives users lots of rope to hang themselves with if they don't understand when to use raw and formatted values.
Another way to handle this could be to override CCK's plain text formatter with something that will just ensure the string is at least valid UTF-8, and otherwise leaves it alone. Altering lines 49-52 in subscriptions_cck.module seem like the place to do this:
if (!($formatted = content_format($field_info, $value, 'plain'))) {
$formatted = content_format($field_info, $value, 'default');
}
Comments
Comment #1
salvisThanks for looking into this. Unfortunately, I don't have time to investigate right now, but I'll come back to it.
Comment #2
salvisWaiting for an answer to #340572: How can I get unescaped plain text?...
Comment #3
jessa_d commentedTo get this working on my site for now, I'm decoding the the entities for plain text:
Comment #4
salvisYes, that looks like a possible work-around, but shouldn't we specify 'UTF-8' to avoid going with ISO-8859-1?
Comment #5
salvis@jessa_d:
Does this really help? Why would plain text contain entities? To me, 'plain' means plain, which is not HTML, and as such has no entities.
If you really get entities from 'plain' text, this looks like a bug in the provider of the field, or am I missing something?
Comment #6
salvisCommitted to both -dev snapshots, will be in the next releases.