From e3af0aa031d59cc5ed941dc62e79a5db9f55a4d3 Mon Sep 17 00:00:00 2001 From: "putterman%netscape.com" Date: Wed, 2 Feb 2000 01:46:24 +0000 Subject: [PATCH] Fix for 8405. Japanese shows up in thread pane sender column. r=nhotta, waterson. --- mailnews/base/src/nsMsgMessageDataSource.cpp | 26 ++++++++++++++++---- xpcom/build/dlldeps.cpp | 2 ++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/mailnews/base/src/nsMsgMessageDataSource.cpp b/mailnews/base/src/nsMsgMessageDataSource.cpp index c405cf703d54..c2f41f610442 100644 --- a/mailnews/base/src/nsMsgMessageDataSource.cpp +++ b/mailnews/base/src/nsMsgMessageDataSource.cpp @@ -41,6 +41,7 @@ #include "nsIMessageView.h" #include "nsMsgUtils.h" #include "nsMessageViewDataSource.h" +#include "nsTextFormatter.h" static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -301,13 +302,28 @@ nsresult nsMsgMessageDataSource::GetSenderName(nsAutoString& sender, nsAutoStrin nsresult rv = NS_OK; if(mHeaderParser) { + char *name; - if(NS_SUCCEEDED(rv = mHeaderParser->ExtractHeaderAddressName (nsnull, nsAutoCString(sender), &name))) - { - *senderUserName = name; + char *senderUTF8 = sender.ToNewUTF8String(); + if(!senderUTF8) + return NS_ERROR_FAILURE; + + if(NS_SUCCEEDED(rv = mHeaderParser->ExtractHeaderAddressName("UTF-8", senderUTF8, &name))) + { + if(name) + { + PRUnichar *newSender; + nsAutoString fmt("%s"); + newSender = nsTextFormatter::smprintf(fmt.GetUnicode(),name); + if(newSender) + { + senderUserName->SetString(newSender); + nsTextFormatter::smprintf_free(newSender); + } + nsCRT::free(name); + } + Recycle(senderUTF8); } - if(name) - PL_strfree(name); } return rv; } diff --git a/xpcom/build/dlldeps.cpp b/xpcom/build/dlldeps.cpp index c271dfc54412..1b8c67588885 100644 --- a/xpcom/build/dlldeps.cpp +++ b/xpcom/build/dlldeps.cpp @@ -79,6 +79,8 @@ TestSegmentedBuffer(); void XXXNeverCalled() { nsTextFormatter::snprintf(nsnull,0,nsnull); + nsTextFormatter::smprintf(nsnull, nsnull); + nsTextFormatter::smprintf_free(nsnull); dummyComparitor dummy; nsVoidArray(); nsAVLTree(dummy, nsnull);