Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle Java Question
On Wed, 29 Jun 2005 07:00:34 -0700, DA Morgan <damorgan_at_psoug.org> wrote:
>As long as we are discussing UTL_MAIL, and I like it a lot, there is
>one small thing about it I find: Well unsettling. It does something
>in the header that works in most news readers but in a small percentage
>displays the TO and FROM preceeded with "=?WINDOWS-1252?Q?".
>
>Does anyone have a workaround?
Well, it's required by RFC822 [1] (all headers must be 7-bit ASCII) and RFC2407 [2] (which defines the encoding scheme to get non-ASCII characters into headers - resulting in the format shown above).
But Oracle's being far too eager to go for the full encoding scheme, using it even when the string in whatever character set encoding you're using contains only the ASCII subset of characters.
Claimed by Oracle to be fixed in 10.1.0.4 and 10gR2 at least for the Subject header, but it still does it in 10.1.0.4 here. Bug 3506588. Hopefully they've applied a sensible fix to only kick in with the encoding when the string is outside the range of 7-bit ASCII rather than abandoning the (required) encoding entirely. And hopefully they'd apply the same fix to the To and From headers.
One guess to avoid it would be to persuade UTL_MAIL that the parameters are in US7ASCII so it knows it doesn't need to do any encoding. Can't think of a way of doing that, though. The CONVERT function looks like the best bet, but:
begin
UTL_MAIL.SEND (
sender => CONVERT('Andy Hassall <andyh_at_server.localhost>', 'US7ASCII'), recipients => CONVERT('Andy Hassall <andyhassall_at_gmail.com>', 'US7ASCII'), subject => CONVERT('utl_mail', 'US7ASCII'), message => 'this is a test'
... still encodes the headers in my database's character set (ISO-8859-15).
Also odd from looking at the emails UTL_MAIL sends is that it always goes for a multipart/mixed message even when there's just a single message part to send. The output all appears to be in line with standards, it's just there's better ways of formatting it for plain emails.
[1] http://www.faqs.org/rfcs/rfc822.html [2] http://www.faqs.org/rfcs/rfc2047.html
-- Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis toolReceived on Wed Jun 29 2005 - 14:43:10 CDT