Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Subject line in File | Send Link... mail uses strange characters instead of non-ASCII characters (probably UTF-8)

RESOLVED FIXED in mozilla13


Core Graveyard
File Handling
14 years ago
a year ago


(Reporter: Jesper Hertel, Assigned: smontagu)


({intl, relnote})

Windows 2000
intl, relnote
Dependency tree / graph
Bug Flags:
blocking1.4.2 -
blocking1.7a -

Firefox Tracking Flags

(Not tracked)




(1 attachment, 1 obsolete attachment)



14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007

When I use File | Send Link... on a page which title contains non-ASCII
characters, e.g. the Danish characters æøå, the subject line in the resulting
e-mail in Outlook 2000 contains two strange characters on each place where one
of the Danish characters should have been.

When I use File | Send Link... on the page , this mailto URL is fired: 

(I collected this mailto by modifying the registry key
reg:\HKEY_CLASSES_ROOT\mailto\shell\open\command\(Default) to point to a small
Python script that collected the arguments sent.)

The title of the page is "PC World - Digital video på 65 gram", but the subject
in the resulting e-mail in Outlook 2000 is "PC World - Digital video på 65
gram", which the given mailto URL also reflects.

I have found out that in UTF-8, the two characters "Ã¥" is exactly the character

Maybe Mozilla should be converting to code page 1252 in the Windows case before
constructing the mailto url?

Reproducible: Always

Steps to Reproduce:
1. Go to the given URL .
2. Choose File | Send Link...
3. Look at the subject line in the resulting mail.

Actual Results:  
The subject is "PC World - Digital video på 65 gram".

Expected Results:  
The subject should have been "PC World - Digital video på 65 gram".

I use Windows 2000 SP4, Mozilla 1.5, Outlook 2000 SP-3.

Comment 1

14 years ago
I must mention that I have patched my Mozilla 1.5 with (exactly) the patch
mentioned in Bug 217328 comment 14
( But this was a
mailto:body= issue and does not affect this problem. The current subject problem
has also been there all the time, including before I made the patch.

Otherwise I have changed nothing in my installation.

Comment 2

14 years ago
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6b) Gecko/20031129

I´m not using Outlook, but Mozilla MailNews as default mail,
sending to an account I can access via Webmail only I got in the header:
Subject: =?iso-8859-1?Q?Digital_video_p=E5_65_gram?=
and this was displayed like seen on the website.

Can you retest with Mozilla 1.6b, when it comes?

Comment 3

14 years ago
invalid comment #2, I didn´t test what the reporter was claiming.

Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6b) Gecko/20031202

I used File -> Send Link... to send the page using MozillaMail to my account,
Mozilla Mail opened, and was showing Subject and body like below,
same, as I received after sending.

So this is working internally, but I can´t test if it is also working, if using
an external mailclient, like Outlook.
This should be tested by someone using Outlook, or another mailclient.


Subject: PC World - Digital video på 65 gram


Component: XPApps, as in Bug 217328 ?
Component: Browser-General → XP Apps

Comment 4

14 years ago
Using either

Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.7a) Gecko/20040121
Firebird/0.8.0+ (scragz)

or Mozilla 1.6 release, I get the following in QM when I try to "send link"
(Moz) or "send page" (FB):

With older versions of Firebird the page title was also appended (after the word
"subject"), but at least the URL part didn't convert the colon and slashes to
the hex equivalents which make the link completely useless.  This is a major

Flags: blocking1.7a?
Flags: blocking1.4.2?

Comment 5

14 years ago
I just installed Mozilla 1.6 ("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6) Gecko/20040113 MultiZilla/"), and the problem is still the same.

Comment 6

14 years ago
Not a blocker.

Copying someone who might have an idea.
Flags: blocking1.7a?
Flags: blocking1.7a-
Flags: blocking1.4.2?
Flags: blocking1.4.2-

Comment 7

14 years ago
This is actually much easier to see with Firefox since the mail doesn't get in
the way.

I set up my mailto for Lotus Notes and sure enough my subject is wrong.
Assignee: general → file-handling
Component: XP Apps → File Handling
Ever confirmed: true
QA Contact: general → ian

Comment 8

14 years ago
It's a URI.  It contains non-ascii chars.  There is no source document
information.  So it gets encoded as UTF-8 (which is the standard for non-ASCII
chars in URIs in any case); that's what GetAsciiSpec does on nsIURI objects.
<mkaply> biesi: The native charset would be the right call
<biesi> mkaply: yeah, it means unescaping the spec, converting to native
charset, escaping again (probably), and calling shellexecute on that, I suppose

Comment 11

14 years ago
Or you could GetSpec instead of GetAsciiSpec...
104      * Some characters may be escaped.
105      */
106     attribute AUTF8String spec;

doesn't gain you anything.

Comment 13

14 years ago
What mozilla currently does is 'correct'. External mail programs should be
'fixed' to understand IRI (Internationalized Resource Identifier : URIs in
UTF-8) [1].  That is, it's not Mozilla but MS OE, Lotus Notes, etc that should
be fixed. Of course, there's little, if any, we can do about them. How does
Thunderbird work when used as an external mail program for firefox? At least, we
have to get TB to do the 'right thing'. 

We might convert to the most widely used _legacy_ character encoding for a given
locale, but that doesn't seem to be the 'right' thing. What should we do when
there are characters not representable in the encoding? Using IRIs for those
cases _only_ seems to be worse than what we do now. What if the default
character encoding for outgoing emails in MS OE is different from the legacy
encoding of the default system locale? 

A work-around for MS OE users is to change the default encoding (for outgoing
emails) to UTF-8. Nowadays, except for __stupid__ web mail services (such as
hotmail and yahoo mail),  mail clients can handle messages in UTF-8
'transparently'. There should be a similar option in Lotus Notes. We can add
this to the release notes. 

Keywords: intl, relnote

Comment 14

14 years ago
We should probably pay attention to RFC 2368 (mailto URL scheme):

Let me quote from this RFC a bit:

"8-bit characters in mailto URLs are forbidden. MIME encoded 
words (as defined in [RFC2047]) are permitted in header values, 
but not for any part of a "body" hname."

If the data provided by the original bug reporter is correct,
Mozilla does not use MIME in the mailto "subject" URL scheme that
is sent to the mail program when this "File > Send Link"
menu is used. If we are using mailto protocol to populate
the subject header with the title of the document, then 
we can at least indicate what the charset of the MIME encoded
string is. 

Assuming that this is the right way to go, then we have one of
two choices:

1. Use the encoding of the document in which the title resides
and use that as the MIME charset. In this Danish example, that
would be ISO-8859-1. As long the charset is indicated in the MIME'd
URL, any mailer capable of interpreting MIME header should be
ale to handle it.

2. We can uniformly change all non-ASCII titles into UTF-8 MIME
encoded mailto url. 

We earlier had this same discussion in:

where I did not get my opinion to prevail. MIME-decode was checked
in but not MIME-encode. You might want to review the rationale
discussed there and see if that is still valid. 

Comment 15

14 years ago
Thanks for the note on RFC 2368.
Naoki had the following rationale for not supporting it.

> In fact, I am not sure MIME encode in mailto URL is practically useful.
> It is not supported by IE and 4.x. Using UTF-8 for URL is simpler than including
> MIME encoded words inside URL.
 To support RFC 2368, we need to move some  mailnews code out of mailnews into
necko (netwerk/mime : see bug 162765 for a similar change). It's doable, but
before actually doing it,  we have to make sure that what you wrote below is
true. Being able to decode RFC 2047-encoded words is one thing and being able to
decode RFC-2047 encoded words in URLs before putting them in 'Subject' header is

> As long the charset is indicated in the MIME'd
> URL, any mailer capable of interpreting MIME header should be
> ale to handle it.


Comment 16

14 years ago
Protocol handlers can actually be used to invoke any native applications.

These native applications all expect native character sets.

I think it is a bit naive to believe that we should change every mail client
versus fixing our application.

However, I will point out that this doesn't work on IE either :)

Comment 17

14 years ago
> However, I will point out that this doesn't work on IE either

It works on my IE 6.0.2800.1106 with Outlook 2000 SP3 ( on Windows
2000 5.00.2195: The subject of the mail is right when I use File | Send | Link
(or whatever the English translation is - my IE speaks Danish). 

But -- it doesn't use the mailto: protocol. It doesn't matter what I set the
registry key HKEY_CLASSES_ROOT\mailto\shell\open\command\(default) to. IE must
speak directly with Outlook in some way. 

Comment 18

14 years ago
The concept of 'native' charset is not so clear any more on modern Unicode-based
OS' like Windows 2k/XP, Mac OS X, BeOS.  Either we have to leave this alone or
have to make Mozilla compliant to RFC 2368. 

Comment 19

14 years ago
I was testing IE to Notes and it fails there using mailto.

Comment 20

14 years ago
If we do what's suggested in comment #9, characters that have never been a part
of any legacy code page can't be used at all. With what we have now, UTF-8-aware
mail clients can be configured to work for any characters. Obviously, we cannot
fix others' bug (we can report it though), but we shouldn't _break_ (it's not a
fix) ours to work around others' bug. Besides, as time goes on, IRI will be
supported by more and more programs. 

Comment 21

14 years ago
I also have to point out that any characters outside the repertoire of the
current default system locale can't be used, either if we use so-called native
charset.  For instance, Chinese can't be used on Windows with the default locale
set to French. 

beos native charset is utf8, for windows we can use utf16 apis. don'T know about

Comment 23

14 years ago
Well, I'm aware that BeOS uses UTF-8 througout its APIs and file system. Mac OS
X uses UTF-8 (in NFD) on its file system and in some of its APIs (especially,
POSIX-related ones). However, most of Cocoa APIs are based on UTF-16 (afaik).
So, depending on how you look at this, the native charset on Mac OS X can be
either UTf-8 or UTF-16. I'd say it's UTF-8 (assuming what file system uses is
what's closest to the 'native charset'). However, that doesn't help if mail
clients on Mac OS X don't understand IRI. For them, the 'native' charset could
be the most widely used legacy character encoding for a given locale.

More or less the same is true of Windows (2k/XP) except that NTFS uses UTF-16 so
that our 'operational definition' (for the sake of discussion here [1]) on Win
2k/XP has to use either UTF-8 or what we get from GetACP() (or equivalent),
which is   I think what mkaply meant by 'native' charset (if I'm not mistaken).
 GetACP() returns  cp1252, cp949, cp932, cp1251, etc. That doesn't work for
cases I mentioned earlier. 

[1] because using UTF-16 for emails is out of question.   
what prevents us from passing an utf16 url to ShellExecuteW?

Comment 25

12 years ago
Still happens in Firefox 1.0.7 (Win32) & Outlook 2003.

Comment 26

12 years ago
*** Bug 314477 has been marked as a duplicate of this bug. ***

Comment 27

12 years ago
Still happens in Firefox 1.5 & Outlook 2003.

Comment 28

12 years ago
(In reply to comment #24)
> what prevents us from passing an utf16 url to ShellExecuteW?

That's probably what we have to do arguing that RFC 2368 is not so relevant for 'inter-process' communication. One 'minor' problem is that it's not available on Win 9x/ME, but we can work around it. 

Comment 29

10 years ago
Was there any progress on this bug?

Comment 30

8 years ago
Same as bug 412076. Bug fixed in Firefox 3.0.8. The site works fine on Vista.

Comment 31

8 years ago
Still happens in Firefox 3.0.8, Outlook 2003 SP3 and Windows 2000.

Comment 32

8 years ago
Still happens in Firefox 3.0.11, Outlook 2003 SP3 and Windows XP Professional SP3.
Assignee: file-handling → nobody
QA Contact: ian → file-handling

Comment 33

8 years ago
Not only one URL but every URL with non ASCII 7 chars generate bad Subject line in the email.

In french all éèçàîù (.../...) generate messages with characters like that :

Subject line : éèàç - Recherche Google
From page :

Still present in Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv: Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)

Comment 34

8 years ago
I just tried this latest example in Firefox 3.5.5 and it appears to be working now. Has this been fixed or is my mail client compensating in some way? I have outlook 2007.

Comment 35

8 years ago
Tried using FF 3.5.5 under Linux

Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20091107 Firefox/3.5.5 (Swiftfox) (.NET CLR 3.5.30729)

and Thunderbird version (20090817)

and yes it seems to work.

That would mean the bug stands in the email client I guess.

Comment 36

8 years ago
This might have been fixed, but it might also be a Windows-specific bug; in fact that is quite likely if the problem is in converting UTF-8 as if it was the native character set. I'll check next week when I have access to a Windows system.
Assignee: nobody → smontagu

Comment 37

8 years ago
The bug still occurs on Windows on trunk with Outlook Express set as default email client, but not with Thunderbird. The current patch for bug 411511 doesn't fix it, but I may be able to tweak it so that it does (I'm still not sure of the exact code path in question -- the reference in comment 10 is out-of-date).
Depends on: 411511

Comment 38

8 years ago
Created attachment 418854 [details] [diff] [review]
Possible patch

This is only a partial solution, at least on my system (Windows XP Professional with Outlook 2003 (11.83183.8221) SP3 and Outlook Express 6.00.2900.5512).

With both Outlook and Outlook Express it only works for Subjects that are expressible in the default Windows non-unicode character set, even though we call ShellExecuteW with UTF-16 arguments. 

The last 3 hunks of the patch are not strictly relevant, but fix a problem that I found in the WINCE code path while experimenting: 
 { sinfo.lpFile =  NS_ConvertUTF8toUTF16(urlSpec).get(); }
doesn't work because the converted string goes out of scope before it's used. This may be the cause of bug 518164, but I have no way to verify that.

Thoughts? Comments?
Attachment #418854 - Flags: superreview?(cbiesinger)
Attachment #418854 - Flags: review?(benjamin)


8 years ago
Blocks: 518164
Attachment #418854 - Flags: review?(benjamin) → review+

Comment 39

8 years ago

Same result with Outlook 2003 and it works with IE 7 so it really looks like
this is the Firefox browser somehow.
Comment on attachment 418854 [details] [diff] [review]
Possible patch

I don't think this is the right fix. There's no guarantee that after unescaping you'll get UTF-8...

Comment 41

8 years ago
(In reply to comment #40)
> (From update of attachment 418854 [details] [diff] [review])
> I don't think this is the right fix. There's no guarantee that after unescaping
> you'll get UTF-8...

No? Did I misunderstand comment 8?
That's true for the specific case of Send Link, but LoadURI has other callers. For example, if a web page has a mailto: URI, in Firefox that will go through this function. And in those case we do have the web page's charset information, and of course it's also possible that the web page already has specified escaped characters.

Maybe using GetSpec instead of GetAsciiSpec (and not unescaping stuff in addition to that) would actually be good enough, contrary to comment 12. It would probably fix this bug at least, though there's still cases it would get wrong.

Comment 43

8 years ago
(In reply to comment #42)
> Maybe using GetSpec instead of GetAsciiSpec (and not unescaping stuff in
> addition to that) would actually be good enough, contrary to comment 12. It
> would probably fix this bug at least, though there's still cases it would get
> wrong.

No, it turns out that it doesn't fix this bug.

Comment 44

8 years ago
Created attachment 423795 [details] [diff] [review]
More stable patch

Like the previous patch, this works well with Thunderbird, but only works with Outlook and Outlook Express if the page title is expressible in the native character set.
Attachment #418854 - Attachment is obsolete: true
Attachment #423795 - Flags: superreview?(cbiesinger)
Attachment #423795 - Flags: review?(benjamin)
Attachment #418854 - Flags: superreview?(cbiesinger)
Comment on attachment 423795 [details] [diff] [review]
More stable patch

Is there a way to write an automated test for this (without registering a system MIME handler, which doesn't sound wise)? If not, litmus?
Attachment #423795 - Flags: review?(benjamin) → review+
Attachment #423795 - Flags: superreview?(cbiesinger) → superreview+

Comment 46

6 years ago
Target Milestone: --- → mozilla13
Last Resolved: 6 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.