I've noticed encoding problems (how surprizing!) using the email application with a url as body to get the bodycontent from.
In the page you have something like this:
<mm:createnode id="mail_object" type="email">
<mm:setfield name="from">[EMAIL PROTECTED]</mm:setfield>
<mm:setfield name="subject">Nieuwsbrief</mm:setfield>
<mm:setfield name="body">http://www.tralala.nl/niewsbriefbody.jsp</mm:setfield>
</mm:createnode>
<mm:createrelation source="mail_object" destination="subscribers" role="related" />
<!-- send the email node --> <mm:node referid="mail_object"> <mm:field name="mail(oneshot)" /> </mm:node>
The processing of these fields is done in org.mmbase.applications.email.EmailHandler it checks the content of the "body" field and if it contains a url (http://...) it will get the contents of that url to use as body using:
URL includeURL = new URL(absoluteUrl+prefix+params); HttpURLConnection connection = (HttpURLConnection) includeURL.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader (connection.getInputStream()));
This means that an InputStreamReader is created using the default/system encoding (probably ISO-8859-1), which is probably not wat you want since you want to use the encoding that is actually being used for the page you are getting. (utf-8 in my case)
Right now I don't see an easy way to determine te get the encoding of the page you're getting, does anyone know a solution for this? The only way I see right now is parsing the Content-Type header.
groeten,
Simon
PS: in case anyone is wondering why I don't just use a mm:include to get the content for the mail - I use the url method because I'm mailing a group of people and the email application will post the usernumber of the users to the page when you use a url. I need the usernumber to generate an 'unsubscribe' link for every user.
