The problem here appears to be that I need a unicode string in order to 
call the search routine.  My question now becomes, how do I create a 
unicode string from js?  Here's what I've found, if someone sees 
something that I'm missing please let me know because right now I'm 
going in circles.

I need to set the SearchTerm.value.str in order to do a search in the 
Subject of a message (SearchTerm is an nsIMsgSearchTerm).  The 
SearchTerm.value.str is a wstring (which to me means it needs to be a 
unicode string).  Alright so I've dug through the code and I've done 
some searches on lxr and here's what I've come up with:

I should be able to get a unicode string to pass in by calling 
ConvertToUnicode([const] in string) after getting the service of an 
nsIScriptableUnicodeConverter.  Calling ConvertToUnicode by itself 
throws an exception since mDecoder isn't initialized (I found this out 
in mozilla/intl/uconv/src/nsScriptableUConv.cpp 
nsScriptableUnicodeConverter::ConvertToUnicode).  It seems as though 
mDecoder gets initialized in 
nsScriptableUnicodeConverter::InitConverter.  The only time this method 
is called is when the charset is set in the interface (attribute wstring 
charset).  Here is where my circular problem appears.  It seems as 
though the charset itself needs to be a unicode string, which takes me 
back to the beginning of this paragraph.  Am I missing something obvious?

Dan




Reply via email to