Last Comment Bug 374039 - Some dates not displayed when LC_TIME=hi_IN.UTF-8
: Some dates not displayed when LC_TIME=hi_IN.UTF-8
Status: NEW
: fixed1.8.0.12, fixed1.8.1.4
Product: Core
Classification: Components
Component: Internationalization (show other bugs)
: Trunk
: x86 Linux
: -- normal with 1 vote (vote)
: mozilla1.9alpha5
Assigned To: jag (Peter Annema)
: Makoto Kato [:m_kato]
Depends on:
Blocks: 181515
  Show dependency treegraph
Reported: 2007-03-15 04:03 PDT by Aniruddha Shankar
Modified: 2007-05-10 03:23 PDT (History)
5 users (show)
smontagu: in‑testsuite?
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Email that does not display the date field. (1.59 KB, message/rfc822)
2007-03-18 01:29 PDT, Aniruddha Shankar
no flags Details
Email that DOES display the date (1.78 KB, message/rfc822)
2007-03-18 01:32 PDT, Aniruddha Shankar
no flags Details
Patch (1.81 KB, patch)
2007-03-19 03:56 PDT, Simon Montagu :smontagu
jshin1987: review+
jag-mozilla: superreview+
dveditz: approval1.8.1.4+
dveditz: approval1.8.0.12+
Details | Diff | Splinter Review
The not-so-quick fix (6.32 KB, patch)
2007-03-20 05:53 PDT, jag (Peter Annema)
smontagu: review+
cbiesinger: superreview+
Details | Diff | Splinter Review

Description Aniruddha Shankar 2007-03-15 04:03:03 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20060601 Firefox/ (Ubuntu-edgy)
Build Identifier: version (20070306)

I'm using mozilla thunderbird under kubuntu dapper drake 6.10. . My locale settings are as follows:


locales available on my machine are :

Unless I change LC_TIME to en_US.UTF-8 some dates are not displayed by thunderbird, as the screenshot shows. Some dates are displayed properly, however.

Reproducible: Always

Steps to Reproduce:
Comment 1 Aniruddha Shankar 2007-03-15 04:05:38 PDT
The screenshot is at . And  I mistakenly stated that I'm using dapper drake when I actually meant edgy eft.
Comment 2 Aniruddha Shankar 2007-03-15 04:12:45 PDT
I believe the results should be reproducible on other machines by installing a hindi font (there should be an indic fonts package in your repository somewhere), exporting the variable and starting up your copy of thunderbird.
Comment 3 Magnus Melin 2007-03-15 13:23:12 PDT
Could an extension cause the problem? Have you tried tb 2.0 (not final yet, but soon)? <>
Comment 4 Aniruddha Shankar 2007-03-16 04:47:52 PDT
Magnus, Hi. 
Could you tell me how to run this particular file ? I downloaded the tarball and extracted it, but when I try and run thunderbird, I get the following error:

karim@bhim:~/thunderbird-2.0pre.en-US.linux-i686/thunderbird$ pwd
karim@bhim:~/thunderbird-2.0pre.en-US.linux-i686/thunderbird$ ./thunderbird
Segmentation fault

Is this merely a problem with this particular nightly?        
Comment 5 Aniruddha Shankar 2007-03-16 16:27:15 PDT
Since I couldn't get the nightly to run, I went home and built it on my Gentoo box. I was running tbird version 2 beta 2 build 20070316. I also disabled all extensions and made sure that LC_ALL and LC_CTIME were set to hi_IN.UTF-8 . The problem persisted and I have uploaded a flash video that illustrates the issue to . 
Comment 6 Magnus Melin 2007-03-17 04:10:31 PDT
Don't know why the nightly didn't run for you...

Do you get any errors in the Error Console (JavaScript Console in 1.5)? 

Is there something particular with the dates of the mails that don't display? Can you give the Date: header of a few of the ones that doesn't work?
Comment 7 Aniruddha Shankar 2007-03-18 01:28:03 PDT
On the unstable build (running on Gentoo), i get this message (I think it's not relevant but pasting anyway)

Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIIOService2.manageOfflineStatus]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///usr/lib/mozilla-thunderbird/components/offlineStartup.js :: anonymous :: line 95"  data: no]
Source File: file:///usr/lib/mozilla-thunderbird/components/offlineStartup.js
Line: 95

Comment 8 Aniruddha Shankar 2007-03-18 01:29:04 PDT
Created attachment 258942 [details]
Email that does not display the date field.

This is an email (.eml file) that does not display the date field.
Comment 9 Aniruddha Shankar 2007-03-18 01:32:27 PDT
Created attachment 258943 [details]
Email that DOES display the date

Thunderbird DOES show the date of this email (.eml file)
Comment 10 Simon Montagu :smontagu 2007-03-18 06:20:23 PDT
Is it possible that dates with times PM are being displayed and times AM are not?
Comment 11 Simon Montagu :smontagu 2007-03-18 14:21:26 PDT
More exactly, I think some dates need more space than the 80 bytes that we allow in nsDateTimeFormatUnix::FormatTMTime().
Comment 12 Simon Montagu :smontagu 2007-03-19 03:56:01 PDT
Created attachment 258982 [details] [diff] [review]

I think that this was probably the original intention, considering that NSDATETIME_FORMAT_BUFFER_LEN*2 is the size of strOut.
Comment 13 Jungshik Shin 2007-03-19 18:00:09 PDT
Comment on attachment 258982 [details] [diff] [review]


It appears that 'x2' factor was used originally for the inflation of a single byte in ASCII/ISO-8859-x to 2 bytes. Probably because UTF-8 locales were not widely used.
Comment 14 Simon Montagu :smontagu 2007-03-19 21:54:23 PDT
Moving back to the original component to request blocking-thunderbird2. This makes the main mail display seriously hard to use and affects all the Indian languages. Risk is minimal: the patch doesn't even change the size of the buffer used to receive the formatted date string.
Comment 15 Jungshik Shin 2007-03-20 00:48:26 PDT
Comment on attachment 258982 [details] [diff] [review]

oops. forgot '+' it
Comment 16 jag (Peter Annema) 2007-03-20 05:53:42 PDT
Created attachment 259086 [details] [diff] [review]
The not-so-quick fix

This compiles (on my Mac) but is untested. Maybe something we should consider for trunk?
Comment 17 jag (Peter Annema) 2007-03-20 05:56:22 PDT
Comment on attachment 258982 [details] [diff] [review]

sr=jag for a minimalistic branch fix.
Comment 18 Scott MacGregor 2007-03-20 11:50:04 PDT
Comment on attachment 258982 [details] [diff] [review]

We could be tagging for Thunderbird 2 as early as tomorrow morning, I'll ping the triage team to see if they'll approve this for the branch. It looks very low risk and fixes a problem for intl mail users on linux.
Comment 19 Daniel Veditz [:dveditz] 2007-03-20 15:33:04 PDT
Comment on attachment 258982 [details] [diff] [review]

Approved for 1.8/1.8.0 branches, a=dveditz
Comment 20 Scott MacGregor 2007-03-20 15:37:10 PDT
Simon, I'll land the branch patch for 1.8 later tonight if you don't beat me to it to ensure that's its checked in before we tag tomorrow morning. Thanks again for working on this.
Comment 21 Scott MacGregor 2007-03-20 21:43:41 PDT
Simon I landed this on the 1.8 branch tonight so it would make it into tb2. I'll let you land it on the trunk and the 1.8.0 branch. Thanks again for the patch.
Comment 22 Simon Montagu :smontagu 2007-03-21 02:46:18 PDT
Comment on attachment 259086 [details] [diff] [review]
The not-so-quick fix

This has to be the most generous response to a sr request ever :) I wanted to  do something like this for trunk after getting the quick fix in for TB2. Thanks for beating me to it.
Comment 23 Simon Montagu :smontagu 2007-03-21 11:20:49 PDT
Landed on 1.8.0 branch. Thanks for the 1.8 checkin, Scott.
Comment 24 Simon Montagu :smontagu 2007-03-21 12:10:46 PDT
It would be good to have a test for this, but do we have a way to force a locale when running tests?
Comment 25 Christian :Biesinger (don't email me, ping me on IRC) 2007-03-24 05:57:54 PDT
Comment on attachment 259086 [details] [diff] [review]
The not-so-quick fix

The function here has a locale argument, doesn't it? But the system may not have the hi_IN locale installed, so testing this may not be possible...

+    stringOut.AssignLiteral("");

I'd make that stringOut.Truncate();

+      if (NS_SUCCEEDED(rv))
+        stringOut.Assign(unichars, unicharLength);

I think you could use stringOut.SetLength/BeginWriting to write directly to that string.
Comment 26 Aniruddha Shankar 2007-04-15 14:03:58 PDT
(In reply to comment #23)
> Landed on 1.8.0 branch. Thanks for the 1.8 checkin, Scott.

I just upgraded to and the problem still remains. Is the 1.8.0 branch  not going to be used for thunderbird ?
Comment 27 Scott MacGregor 2007-04-16 07:33:16 PDT
thunderbird 2 was shipped from So this fix will show up in the first security update after the release. Sorry for the confusion.
Comment 28 Simon Montagu :smontagu 2007-05-10 03:23:44 PDT
jag, can you go ahead and check this in?

Note You need to log in before you can comment on or make changes to this bug.